my $row = 0; while () { # data loop is here # unpack, etc. $worksheet->write_row($row++, 0, \@fields); }