On 05/09/2005 12:45 PM, Robert said:

I am pulling data out of Oracle and putting it into an Excel spreadsheet.

Using this:

while ( $row = $sth->fetchrow_arrayref ) {
    # this is a fast and simple way to deal with nulls:
    foreach (@$row) { $_ = '' unless defined }
    push (@results, @$row);

This puts all the columns fetched into one linear array. For database contents:


  row0: s, 1, A
  row1: s, 3, B
  row2: s, 4, C

  @results = ( "s", "1", "A", "s", "3", "B", "s", "4", "C" )

If you want to keep straight which rows are which, you need something like this:

  # Use [] to make sure each row is a separate array reference.
  push @results, [ @$row ];

}

my $workbook = Spreadsheet::WriteExcel->new("report.xls");
$worksheet   = $workbook->add_worksheet();
$worksheet->write_row('A2', [EMAIL PROTECTED]);

I can't say what this does because this isn't the Spreadsheet list.

--
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to