I did, however, find a solution. I extracted the cell values then ran a substitute =~ s/,//; on the scalar value before writing it to a text file, followed by a comma.
#!c:/perl/bin/perl.exe use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; open (OUTPUT,">>","c:/assess/output.txt"); my $Excel = Win32::OLE->GetActiveObject ('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); my $Book = $Excel->Workbooks->Open ("C:/assess/assessment.xls"); my $Sheet = $Book->Worksheets(1); my $LastRow = $Sheet->UsedRange->Find({What=>"*", SearchDirection=>xlPrevious, SearchOrder=>xlByRows})->{Row}; my $array = $Sheet->Range("B2:"."F".$LastRow)->{'Value'}; foreach my $ref_array (@$array) { foreach my $scalar (@$ref_array) { $scalar =~ s/,//; print OUTPUT "$scalar,"; } print OUTPUT "\n"; } $Book->Close;
Your warning regarding the use of commas in formulas was wise but in this case irrelevant. The subsequent processing used only integer values associated with unit cost, unit rate and account code (text string). All fields with formulas are ignored.
Thanks again for taking the time to reply. It ain't pretty but it will do the job.
generator
In reply to Re^2: Win32::OLE Excel search and replace commas
by generator
in thread Win32::OLE Excel search and replace commas
by generator
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |