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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • somsub
    New Member
    • Nov 2008
    • 17

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

    Hi,

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

    Code:
    use Spreadsheet::WriteExcel;
    $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...!!
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by somsub
    Hi,

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

    Code:
    use Spreadsheet::WriteExcel;
    $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...!!
    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.

    Regards,

    Jeff

    Comment

    • somsub
      New Member
      • Nov 2008
      • 17

      #3
      yaa... !! I tried with single quote in the place of double quote but got the same "Unable to read file " error .

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        Originally posted by somsub
        yaa... !! I tried with single quote in the place of double quote but got the same "Unable to read file " error .
        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.

        Comment

        • somsub
          New Member
          • Nov 2008
          • 17

          #5
          yaa.... It is located in the same folder where the script is . But I tried with different path also but got the same error .

          Comment

          • numberwhun
            Recognized Expert Moderator Specialist
            • May 2007
            • 3467

            #6
            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.

            Regards,

            Jeff

            Comment

            • RonB
              Recognized Expert Contributor
              • Jun 2009
              • 589

              #7
              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?

              Comment

              • somsub
                New Member
                • Nov 2008
                • 17

                #8
                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 .

                Comment

                Working...