spreadsheet-xlsx icon indicating copy to clipboard operation
spreadsheet-xlsx copied to clipboard

Cannot index Cells

Open 4zv4l opened this issue 1 week ago • 0 comments

Hi !

I basically copy-pasted the example from the Readme and just changed the sheet name. It seems that I cannot index any cells, I tried multiple way but none worked. For this issue I will simply stick to the one showed in the readme.

Rakudo version

Welcome to Rakudo™ Star v2025.10.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2025.10.

Zef info

I am using the latest version.

$ zef info Spreadsheet::XLSX
===> Searching for: Spreadsheet::XLSX
- Info for: Spreadsheet::XLSX
- Identity: Spreadsheet::XLSX:ver<0.3.2>:auth<zef:raku-community-modules>
- Recommended By: Zef::Repository::Ecosystems<fez>
- Installed: Yes
Author:	 Jonathan Worthington
Description:	 Work with Excel (XLSX) spreadsheets
License:	 Artistic-2.0
Provides: 14 modules
Depends: 2 items
$ zef list --installed | grep XLSX
===> Found via inst#/home/sibl/Documents/git/star/share/perl6/core
===> Found via inst#/home/sibl/Documents/git/star/share/perl6/site
Spreadsheet::XLSX:ver<0.3.2>:auth<zef:raku-community-modules>

Code

#!/usr/bin/env raku

use Spreadsheet::XLSX;

my $workbook = Spreadsheet::XLSX.load('sheet.xlsx');

say "Workbook has {$workbook.worksheets.elems} sheets";

# Doesnt work for me, I need to add worksheets[0] (or any index)
# No such method 'name' for invocant of type 'List'.
say $workbook.worksheets[0].name;

my $cells = $workbook.worksheets[0].cells;
say .value with $cells[0;0];      # A1
say .value with $cells[0;1];      # B1
say .value with $cells[1;0];      # A2
say .value with $cells[1;1];      # B2

result

Workbook has 1 sheets
2025 - 2026 Some Important Title
Too few positionals passed; expected 2 arguments but got 1
  in block  at /home/sibl/Documents/git/star/share/perl6/site/sources/22B14971541474027035F5EA10CC7FEAD3BA88D8 (Spreadsheet::XLSX::Worksheet) line 48
  in method idx-from-colref at /home/sibl/Documents/git/star/share/perl6/site/sources/22B14971541474027035F5EA10CC7FEAD3BA88D8 (Spreadsheet::XLSX::Worksheet) line 48
  in method maybe-load-from-backing at /home/sibl/Documents/git/star/share/perl6/site/sources/22B14971541474027035F5EA10CC7FEAD3BA88D8 (Spreadsheet::XLSX::Worksheet) line 118
  in method AT-POS at /home/sibl/Documents/git/star/share/perl6/site/sources/22B14971541474027035F5EA10CC7FEAD3BA88D8 (Spreadsheet::XLSX::Worksheet) line 69
  in sub postcircumfix:<[; ]> at /home/sibl/Documents/git/star/share/perl6/site/sources/980FC23D6FE0F2A5C012026C23A9D53F71A91E74 (Spreadsheet::XLSX) line 342
  in block <unit> at xlsx.raku line 14

4zv4l avatar Nov 25 '25 08:11 4zv4l