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
In reply to Re: Using Perl and WriteExcel to split data from one column to many others
by kcott
in thread Using Perl and WriteExcel to split data from one column to many others
by squarez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |