my $format1=$workbook->add_format(); $format1->set_bold(); //query my $sth1 = $dbh->prepare($sql1); $sth1->execute(); # write the data into worksheet my $row1=1; while(my @field=$sth1->fetchrow_array){ my $arr_ref=\@field; $worksheet1->write_row($row1,0,$arr_ref); $row1++; }