Hi,
I have a perl script to export workbook data into several
text files inside a separate directory. How can I configure
BC2 to try to compare two directories instead of two files?
Please see script at the end. It's not pretty, but I think
it should work... At least I get one dir and inside it one
text file for each worksheet.
Thanx,
--jouni
#!/usr/bin/perl -w
use strict;
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
if ((scalar(@ARGV)) != 2)
{
print "Usage: $0 infile outfile\n";
exit;
}
use Cwd;
my $debug = 0;
my $folder = $ARGV[0]; # input filename
$folder =~ s/[\<\>\?\[\]\:\|\*\\\.\s]//g;
mkdir $folder;
chdir $folder or die "Cannot chdir to $folder\n";
print "DIR: ".cwd()."\n";
print $folder . "\n" if $debug;
my $Excel = Win32::OLE->new('Excel.Application', 'Quit');
$Excel->{DisplayAlerts} = 0; # don't ask, just overwrite
# Original for BC2 which compares only first sheets of two excel files
#my $Book = $Excel->Workbooks->Open($ARGV[0]);
#$Book->Worksheets(1)->SaveAs($ARGV[1],xlTextMSDOS);
#$Book->Close(0);
my $Book = $Excel->Workbooks->Open($ARGV[0]);
my $curr_sheet = $Book->Worksheets->Count;
while ($curr_sheet != 0) {
print $Book->Worksheets($curr_sheet)->Name . "\n";
$Book->Worksheets($curr_sheet)->SaveAs(cwd()."\\".$Book->Worksheets($curr_sheet)->Name,xlTextMSDOS);
--$curr_sheet;
}
$Book->Close;
# end of file
I have a perl script to export workbook data into several
text files inside a separate directory. How can I configure
BC2 to try to compare two directories instead of two files?
Please see script at the end. It's not pretty, but I think
it should work... At least I get one dir and inside it one
text file for each worksheet.
Thanx,
--jouni
#!/usr/bin/perl -w
use strict;
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
if ((scalar(@ARGV)) != 2)
{
print "Usage: $0 infile outfile\n";
exit;
}
use Cwd;
my $debug = 0;
my $folder = $ARGV[0]; # input filename
$folder =~ s/[\<\>\?\[\]\:\|\*\\\.\s]//g;
mkdir $folder;
chdir $folder or die "Cannot chdir to $folder\n";
print "DIR: ".cwd()."\n";
print $folder . "\n" if $debug;
my $Excel = Win32::OLE->new('Excel.Application', 'Quit');
$Excel->{DisplayAlerts} = 0; # don't ask, just overwrite
# Original for BC2 which compares only first sheets of two excel files
#my $Book = $Excel->Workbooks->Open($ARGV[0]);
#$Book->Worksheets(1)->SaveAs($ARGV[1],xlTextMSDOS);
#$Book->Close(0);
my $Book = $Excel->Workbooks->Open($ARGV[0]);
my $curr_sheet = $Book->Worksheets->Count;
while ($curr_sheet != 0) {
print $Book->Worksheets($curr_sheet)->Name . "\n";
$Book->Worksheets($curr_sheet)->SaveAs(cwd()."\\".$Book->Worksheets($curr_sheet)->Name,xlTextMSDOS);
--$curr_sheet;
}
$Book->Close;
# end of file
Comment