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
In reply to Re: Create CSV file from xlsx file
by kcott
in thread Create CSV file from xlsx file
by viji234
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |