#!perl use strict; use warnings; use Excel::Writer::XLSX; my $book = Excel::Writer::XLSX->new( 'comma.xlsx' ); my $sheet = $book->add_worksheet(); # Add and define a format my $num = join ';','[>=10000000]##\,##\,##\,###', '[>=100000]##\,##\,###', '#,##0'; #$num = '##,##0'; # this does not work my $fmt_comma = $book->add_format(num_format=>$num); # format whole column my $width = 20; $sheet->set_column( 0, 1, $width, $fmt_comma ); my $n = 1; for (1..10){ $n=$n*10; $sheet->write_number( $_, 0, $n); $sheet->write_number( $_, 1, -$n); }