By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

Not able to open excel sheet created by Spreadsheet::WriteExcel .

P: 16

When I tried to open excel sheet created by below code with MSexcel it showing "Unable to read file " error .

Expand|Select|Wrap|Line Numbers
  1. use Spreadsheet::WriteExcel;
  2. $workbook = Spreadsheet::WriteExcel->new("sm2.xls");
I am using winxp OS and MS excel 2003 ....

Advance thanks fr any help on this ..... its urgnt fr me...!!
Oct 10 '09 #1
Share this Question
Share on Google+
7 Replies

Expert Mod 2.5K+
P: 3,503
As shown in the modules cpan page, did you try single quotes instead of double quotes? Also, check the path to the file to ensure its in the same location as the script.

Also, please use code tags when putting code in the forums.


Oct 11 '09 #2

P: 16
yaa... !! I tried with single quote in the place of double quote but got the same "Unable to read file " error .
Oct 11 '09 #3

Expert Mod 2.5K+
P: 3,503
Ok, what about the other suggestion... the path to the file? Is it located where the script is? If not, then you will probably have to tell the script that.
Oct 11 '09 #4

P: 16
yaa.... It is located in the same folder where the script is . But I tried with different path also but got the same error .
Oct 11 '09 #5

Expert Mod 2.5K+
P: 3,503
Ok, now that I have opened my eyes and reread your original question I can see you are trying to open the newly created file with Excel.

So, does the file that was created have a size other than zero? Also, the code you showed, is that all there is or did you create data and populate the workbook? If not, that may be the issue you are having.


Oct 12 '09 #6

Expert Mod 100+
P: 589
You need to show us more of your code.

Do you have any error handling on the file creation?

Are you populating the file with any data?

Did you explicitly close the file before trying to open it with Excel?

Are you manually opening the file in Excel or are you doing it in your script via Win32::OLE?
Oct 13 '09 #7

P: 16
Thanx guys fr ur interest and valuable inputs .....
As per your suggestion I added one more line that is "$workbook->close();"
to close it explicitly at the end of previously mentioned code . After the execution of this line i could able to open the excel sheet manually with MS excel with out any error.

Thanks a lot .
Oct 13 '09 #8

Post your reply

Sign in to post your reply or Sign up for a free account.