in reply to Using Perl and WriteExcel to split data from one column to many others
G'day squarez,
Welcome to the monastery.
I can't actually find a module called WriteExcel on CPAN. There's a lot with WriteExcel in the name: I'm going to guess you're using Spreadsheet::WriteExcel.
This module has a method called write_row() whose documentation has:
"... This is useful for converting the results of a database query into an Excel worksheet. ..."
You should be able to modify your code to something like (untested):
while (my @res = $sth->fetchrow_array()) { @res = map { defined ? $_ : '' } @res; $worksheet->write_row($i, 0, [@res]); $i++; }
I also noted Excel::Writer::XLSX has a method with the same name which appears to work the same (from a coding perspective).
Even if you're using a different module, you may still find the technique applicable. If not, let us know what you are using.
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using Perl and WriteExcel to split data from one column to many others
by squarez (Initiate) on Oct 03, 2012 at 01:20 UTC | |
by kcott (Archbishop) on Oct 03, 2012 at 02:47 UTC | |
by squarez (Initiate) on Oct 03, 2012 at 17:59 UTC |