I have a problem with file size calculation when I create .xls file using Spreadsheet::WriteExcel
File is created properly and after that I want to email that file to customer.
When I tried to print the file size once its created, getting "0" size.
if I check that in directory, I can see the file with exact size.
Can anyone tell me what's wrong in this code and how to resolve this issue?
Here is my code
use strict; use Spreadsheet::WriteExcel; # Create a new Excel workbook called result.xls my $workbook = Spreadsheet::WriteExcel->new("result.xls"); # Add some worksheets my $sheet = $workbook->add_worksheet("Example"); # Add a Format my $format = $workbook->add_format(); $format->set_align('left'); # Set the width of the column in Sheet $sheet->set_column(0, 5, 30); # Set Sheet as the active worksheet $sheet->activate(); open(FH,"<file1.csv") or die "Cannot read\n"; my($row)=0; while (<FH>) { chomp($_); my(@info) = split(/,/,$_); my $col = 0; foreach my $token (@info) { $sheet->write($row, $col, $token, $format); $col++; } $row++; } close(FH); print "Before sleep\n"; sleep(10); my $filesize = -s "result.xls"; print "Size: $filesize\n"; exit;
In reply to Getting file size Zero by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |