I am new to Perl and hope where is the right place to post.
What I want is simply update Excel file. The following code is by jmcnamara.
Source was this link:
#!/usr/local/bin/perl -wT print "Content-type: text/html\n\n"; use strict; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; my $parser = Spreadsheet::ParseExcel->new(); my $workbookR = $parser->parse('file2.xls'); my $worksheetR = $workbookR->worksheet(0); my ( $row_min, $row_max ) = $worksheetR->row_range(); my ( $col_min, $col_max ) = $worksheetR->col_range(); print "row min:$row_min row_max:$row_max col_max:$col_max\n\n"; # Open the template with SaveParser my $parser2 = new Spreadsheet::ParseExcel::SaveParser; my $template = $parser2->Parse('file2.xls'); my $sheet = 0; my $row = 0; my $col = 0; # Get the format from the cell my $format = $template->{Worksheet}[$sheet] ->{Cells}[$row][$col] ->{FormatNo}; my $workbook; { # SaveAs generates a lot of harmless warnings about unset # Worksheet properties. You can ignore them if you wish. local $^W = 0; # Rewrite the file or save as a new file $workbook = $template->SaveAs('file2.xls'); } # Use Spreadsheet::WriteExcel methods my $worksheet = $workbook->sheets(0); if($row_max == -1){ for my $i (0..4){ $worksheet->write(0, $i, "A$i", $format); }} for my $i (0..$col_max){ $worksheet->write($row_max+1, $i, "B$i", $format); # not work } $workbookR->close(); $workbook->close();

In reply to Re^2: spreadsheet writeexcel by virtuemart1
in thread spreadsheet writeexcel by Biju

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.