Ashwitha has asked for the wisdom of the Perl Monks concerning the following question:
Hi people. I have 2 excel files with data in it. I should make a consolidated excel file from the 2 files. Im able to parse the file but donot how to write back in another excel file. can u please help. The code I used for parsing is shown bellow
#!/usr/bin/perl -w # For Spresdsheet Read/Write Operations use Spreadsheet::ParseExcel; my $excel_filename = $ARGV[0] or die "Must specify filename to parse.\ +n"; #$excel_filename = "sample.xls"; sub Workbook_open{ # Excel file access in universal $u = new Spreadsheet::ParseExcel; $ubook = $u->Parse($excel_filename); $ubook_max_sheets = $ubook->{SheetCount}; print "\nSheet Count = $ubook_max_sheets\n"; foreach $index (0 .. $ubook_max_sheets - 1){ $eSheet = $ubook->{Worksheet}[$index]; $sheetName = $eSheet->{Name}; print"\n\nSheet name : $sheetName\n\n"; if(defined($eSheet->{MaxRow}) and defined($eSheet->{MaxCol})){ $Row_max = $eSheet->{MaxRow}; $Col_max = $eSheet->{MaxCol}; $Row_min = $eSheet->{MinRow}; $Col_min = $eSheet->{MinCol}; foreach $row_num ($Row_min .. $Row_max){ foreach $col_num ($Col_min .. $Col_max){ if(defined($eSheet->{Cells}[$row_num][$col_num]->V +alue)){ $temp = $eSheet->{Cells}[$row_num][$col_num]-> +Value; print "$temp\t"; } } print "\n"; } } } } &Workbook_open();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: writing after parsing
by CountZero (Bishop) on Aug 05, 2014 at 10:15 UTC | |
|
Re: writing after parsing
by Anonymous Monk on Aug 05, 2014 at 09:00 UTC | |
by Ashwitha (Novice) on Aug 06, 2014 at 04:46 UTC | |
|
Re: writing after parsing
by thanos1983 (Parson) on Aug 05, 2014 at 10:11 UTC | |
by Ashwitha (Novice) on Aug 06, 2014 at 06:25 UTC | |
by thanos1983 (Parson) on Aug 06, 2014 at 15:06 UTC | |
by Ashwitha (Novice) on Aug 07, 2014 at 11:49 UTC | |
|
Re: writing after parsing
by thanos1983 (Parson) on Aug 08, 2014 at 13:31 UTC | |
by Anonymous Monk on Aug 08, 2014 at 14:10 UTC | |
by thanos1983 (Parson) on Aug 10, 2014 at 12:43 UTC | |
by Anonymous Monk on Aug 10, 2014 at 17:36 UTC |