I have a Perl script that performs various operations on files in a folder. I orginally set it up to do one file and stop. I then got it to output the data to Excel. Now I want it to do all of the files in the folders and report the data to different worksheets. I can make it name all the worksheets the appropiate names but when it goes to fill in the data it is += incrementing the numbers. So I instead did a foreach $file(@files) to work on the files individually.
Heres the problem; when I had it write to the worksheets it basically overwrited (sp, is that a word?) the same first sheet over and over. So I had a sheet for each file but only the first sheet has info. So I tried selecting every sheet like so:
I was trying $cs as the Worksheets object but it didn't work as well... the error I received is:
Can't call method "Range" without a package or object reference
I just basically want to select or activate or whatever the next sheet to begin writing again.
TIA
wali
Heres the problem; when I had it write to the worksheets it basically overwrited (sp, is that a word?) the same first sheet over and over. So I had a sheet for each file but only the first sheet has info. So I tried selecting every sheet like so:
Code:
foreach $csv(@csvfiles){
$c++; #to create number of sheets corresponding w/ # of
#files
}
$excel->{Visible} = 1;
$excel->{SheetsInNewWorkBook} = $c;
$workbook = $excel->Workbooks->Add();
foreach $cs(@csvfiles){
$kount = 1;
$worksheet = $workbook->Sheets->Add();
$worksheet->{Name} = "$cs";
$worksheet = $workbook->Sheets($cs)->Select();
$worksheet = $workbook->Worksheets($kount)->Activate();
$range=$worksheet->Range('A1:G1');
I was trying $cs as the Worksheets object but it didn't work as well... the error I received is:
Can't call method "Range" without a package or object reference
I just basically want to select or activate or whatever the next sheet to begin writing again.
TIA
wali