Thank you knot.. as you mentioned i changed the script to as below. I am getting the error as below. The script is not writing anything. And also i want to use the sheet separtely not in the loop and want to create the CSV file.
Error: syntax error at test.pl line 20,near "$sheet1{" syntax error at test.pl line 50,near "$sheet1}" aborted due to compilation error
use Spreadsheet::XLSX; use Spreadsheet::Read; my $excel = Spreadsheet::XLSX -> new ('Sample.xlsx',); #print "$excel \n"; my @sheets = qw(Sheet1 Sheet2); my $sheet1 = $sheet[0]; my $sheet2 = $sheet[1]; foreach my $sheet1{ my $sheet=$excel -> Worksheet(); printf("Sheet: %s\n", $sheet); my $maxrow = $sheet -> {MaxRow}; my $Minrow = "3"; $maxroww ||= $Minrow; foreach my $row ( $Minrow .. $maxrow) { $sheet -> {MaxCol} ||= $sheet -> {MinCol}; my @wanted_cols = (9, 10, 11, 21); my @wanted_cells = @{$sheet->{Cells}[$row]}[@wanted_co +ls]; if ($wanted_cells) { printf("( %s , %s ) => %s\n", $row, $col, +$cell -> {Val}); } } }

In reply to Re^2: Create CSV file from xlsx file by viji234
in thread Create CSV file from xlsx file by viji234

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.