use Spreadsheet::WriteExcel::Big; use XML::SAX::ExpatXS; #use lib qw(/vweb/cl2000/docs/); use lib qw(/opt/perl/scripts); use ExcelSAX; $excel_file_path = "/proddata/coll/targift/ftp/"; $book_cnt = 1; $sheet_cnt = 1; # The location of the XML file to be parsed. $file = "/proddata/coll/targift/ftp/TARGIFT_CARDSALES_RPT_031711_0933.xls"; #$file = "OPERATOR_LEAD_RPT062405_51457.xml"; $day = (localtime(time))[3]; $month = ((localtime(time))[4]) + 1; $year = ((localtime(time))[5]) + 1900; $basename = "MONTHLY_INVENTORY_$year"."_$month"."_$day"; $callback = sub { my $worksheet = shift; my $workbook = shift; my $format1 = $workbook->add_format(); $format1->set_num_format('$#,##0.00'); $worksheet->set_landscape(); # Landscape mode $worksheet->set_column(0, 0, 10); $worksheet->set_column(1, 1, 35); $worksheet->set_column(2, 2, 15);; $worksheet->fit_to_pages(1,0); # set to 1 page wide and as long as needed $worksheet->set_footer('&CPage &P of &N'); }; $handler = ExcelSAX->new("$excel_file_path", 0, $callback); $parser = XML::SAX::ExpatXS->new( Handler => $handler ); $parser->parse_uri($file);