require Spreadsheet::WriteExcel::Big; #1A print $foo->header(-type => 'application/vnd.ms-excel', -attachment => 'export.xls', -expires => 'now'); binmode(STDOUT); my $export_sheet = Spreadsheet::WriteExcel::Big->new(\*STDOUT) or warn("Unable to create new Excel document"), do_empty(), exit; #1B my $sheet = $export_sheet->add_worksheet('Support Export'); ##spreadsheet header row and formatting elided## my $row_num=1; my $stop = 17986; #2 $stop = 10; #3 my $count = 0; #$results is an arrayref of hashrefs from a db query foreach(@$results) { $count++; last if $count > $stop; $sheet->write_row($row_num++, 0, [$_->{issue_id}, $_->{issue_name}, $_->{contact_name}, $_->{company_name}, $_->{staff_name}, $_->{product_name}, $_->{issue_status}, $_->{issue_submitted}, $_->{issue_opened}, $_->{issue_resolved}, $_->{issue_closed}, $_->{billable}, $_->{non_billable}, $_->{issue_resolution}],); } $export_sheet->close;