in reply to Re^2: Getting an exception while reading excel file using Win::OLE from a current directory
in thread Getting an exception while reading excel file using Win::OLE from a current directory

This is the same problem as you have when opening a file.

Always use absolute path names when talking to Excel.

  • Comment on Re^3: Getting an exception while reading excel file using Win::OLE from a current directory

Replies are listed 'Best First'.
Re^4: Getting an exception while reading excel file using Win::OLE from a current directory
by rockyurock (Acolyte) on Feb 28, 2017 at 10:08 UTC
    I tried to add updated_ in front of sheet path below but it does not allow . $Book->SaveAs('updated_'.$dir."\\".$excelfile);

      Did you print out the directory name you are trying to save to?

      my $outdir = 'updated_'.$dir; my $outfile = $outdir."\\".$excelfile; print "Trying to save to directory [$outdir]\n"; print "Trying to save to file [$outfile]\n"; $Book->SaveAs($outfile);

      The directory name you construct makes no sense. Print it out, look at it, and then construct it in a sensible way.

      Actually I want to use the same current directory so I did not specify path of the directory like E:\\ etc