in reply to Create CSV file from xlsx file
G'day viji234,
Welcome to the monastery.
"But my current code writes all the rows and columns of 2 sheets. my code is"
Except that's not your code, is it? Apart from a couple of apparently pointless print statements near the start of the code, you've just copied the SYNOPSIS of the Spreadsheet::XLSX documentation. That code does what the documentation is explaining: it's not going to magically morph into different code to suit your current requirements.
You should be able to see from the code, that you can identify which sheet you're dealing with, using the value of $sheet->{Name}.
Instead of looping through all columns, just get the ones you want from each row, e.g.
my @wanted_cols = (9, 10, 11, 21); my @wanted_cells = @{$sheet->{Cells}[$row]}[@wanted_cols];
The @array[@indices] construct is called an array slice. See perldata: Slices for details.
To write your data to a CSV file, use Text::CSV.
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Create CSV file from xlsx file
by viji234 (Initiate) on Oct 25, 2013 at 06:45 UTC | |
by kcott (Archbishop) on Oct 25, 2013 at 07:41 UTC | |
by viji234 (Initiate) on Oct 28, 2013 at 08:25 UTC | |
by Tux (Canon) on Oct 28, 2013 at 09:17 UTC | |
by viji234 (Initiate) on Oct 28, 2013 at 10:48 UTC | |
|