vassago has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Win32::OLE to open and read spreadsheets. This works fine for a spreadsheet created with Excel, but when I try to use it to open a spreadsheet that I generated using Spreadsheed::WriteExcel, I get this error message:
OLE exception from "Microsoft Office Excel": './test.xls' could not be found. Check the spelling of the file name, +and verify that the file location is correct. If you are trying to open the file from your list of most recently use +d files, make sure that the file has not been renamed, moved, or deleted +. Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Open" at C:/workspace/graph.pl line 12
but, the file is there and does exist, in that directory. The code for opening the Excel sheet is:
The code I'm using to create the spreadsheets is (I'm just posting the relevant parts):use strict; use warnings; use 5.010; #use Spreadsheet::WriteExcel; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn=3; my $Excel=Win32::OLE->GetActiveObject('Excel.Application')|| Win32::OLE->new('Excel.Application', 'Quit'); my $book=$Excel->Workbooks->Open("./test.xls"); my $sheet=$book->Worksheets(1);
I don't know what is wrong. Perhaps there are some permissions that are wrong? Thanks for any help and/or nudges in the right direction.use strict; use warnings; use 5.010; use Spreadsheet::WriteExcel; $filename="".$currSite.".xls"; $workbook = Spreadsheet::WriteExcel->new($filename); $worksheet = $workbook->add_worksheet(); while(<$file>){ $worksheet->write($row,0,$year); $worksheet->write($row,1,$count); $row++; } $workbook->close();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem opening WriteExcel generated spreadsheets with OLE
by jrsimmon (Hermit) on Mar 03, 2010 at 21:04 UTC | |
by vassago (Novice) on Mar 03, 2010 at 21:50 UTC | |
by furry_marmot (Pilgrim) on Mar 04, 2010 at 17:31 UTC |