# Then write the data into your spreadsheet in order my $out_row=0; for (my $row=0; $row<@T; ++$row) { next if !defined $T[$row]; for (my $col=0; $col < @{$T[$row]}; ++$col) { if (defined $T[$row][$col]) { $WS->write($out_row, $col, $T[$row][$col]); print "T[$out_row][$col] = $T[$row][$col]\n"; } } ++$out_row; }