my $row2=1; while(my @field=$sth2->fetchrow_array){ my $col2=0; my $arr_ref=\@field; # print "$field[19]\n";--> This is my field and this is where I need to set the custom format. $worksheet2->write_row($row2,0,$arr_ref); $row2++; }