sogo87 has asked for the wisdom of the Perl Monks concerning the following question:
I successfully parsed an xls file using Spreadsheet::ParseExcel::SaveParser and modified it with Spreadsheet::WriteExcel.
However working with xlsx file is a whole different thing. I am trying to figure out how to work with Spreadsheet::XLSX for parsing and how to make it work with Excel::Writer::XLSX. Spreadsheet::ParseExcel::SaveParser has a SaveAs() method that makes it possible to apply Spreadsheet::WriteExcel methods on the parsed xml file, but I don't understand how to make it work with xlsx file
When using Spreadsheet::ParseExcel::SaveParser and Spreadsheet::WriteExcel I can write:
#!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; # Open the template with SaveParser my $parser = new Spreadsheet::ParseExcel::SaveParser; my $template = $parser->Parse('template.xls'); # Rewrite the file or save as a new file $workbook = $template->SaveAs('new.xls'); # Use Spreadsheet::WriteExcel methods my $worksheet = $workbook->sheets(0); $worksheet->write($row+2, $col, "World2"); $workbook->close();
I would like to do the same with xlsx files. therefore I'm trying to use Spreadsheet::XLSX and Excel::Writer::XLSX. Instead of:
my $parser = new Spreadsheet::ParseExcel::SaveParser; my $template = $parser->Parse('template.xls');
I use
my $excel = Spreadsheet::XLSX -> new ('test.xlsx');
Now, after parsing the xlsx file I would like to add some data to it and I don't know how to do it. As you can see above when using Spreadsheet::ParseExcel::SaveParser I used SaveAs() function, but Spreadsheet::XLSX dosn't have a SaveAs() method. So how do I add data to parsed xlsx file?
I could not find an answer to my question in this link: http://search.cpan.org/~dmow/Spreadsheet-XLSX-0.13-withoutworldwriteables/lib/Spreadsheet/XLSX.pm Thanks you for your help :)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Modifying xlsx file with perl
by kcott (Archbishop) on Oct 02, 2013 at 18:44 UTC | |
Re: Modifying xlsx file with perl
by hdb (Monsignor) on Oct 02, 2013 at 20:12 UTC | |
Re: Modifying xlsx file with perl
by realflash (Acolyte) on Jul 22, 2024 at 19:52 UTC |