http://www.perlmonks.org?node_id=993689

poopay has asked for the wisdom of the Perl Monks concerning the following question:

I have recently created a perl script that aims to collect information from different spreadsheets and combine the data into one spreadsheet.

I've set 2 columns to display data in a date format. The spreadsheet was indeed generated; however, I noticed that the date in the formatted column treat the dates as string.

However, I noticed that if I double-click the cell with the dates then press "Enter", the data is then converted to the format I wanted it to be.

This is a snippet of the code I created

#create your destination spreadsheet my $workbook = Excel::Writer::XLSX->new( 'perl.xlsx' ); my $worksheet = $workbook->add_worksheet(); #set date format for rows H and I my $format = $workbook->add_format( num_format => 'yyyy-mm-dd' ); #create some formatting for dates $worksheet->set_column('H:I', undef, $format); # for every spreadsheet... foreach $file (@files) { do { #Read the input file $excel = new Spreadsheet::BasicRead($file); #Get the data from each row while ($dataref = $excel->getNextRow()) { #Write the data into your destination spreadsheet and incr +ement row my @data = @$dataref; $worksheet->write_row($row, 0, \@data); $row++; } } }

Is there a way for my output to be displayed properly in the correct format without me doing this? Hope someone can help.