Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Open Excel Error Using PowerShell in SQL Server Agent Job Expand / Collapse
Author
Message
Posted Tuesday, June 18, 2013 9:53 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 9, 2013 11:03 AM
Points: 21, Visits: 140
Ok, I now see that the "Desktop" file workaround fixes a "save as" exception, and my exception occurs when opening the Excel file. I am going to convert my excel to csv and see if that cures the problem.
Thank you for all of your help!
Post #1464753
Posted Wednesday, July 17, 2013 3:27 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 4:55 AM
Points: 221, Visits: 1,128
Lrobinson 93181 (6/18/2013)
Ok, I now see that the "Desktop" file workaround fixes a "save as" exception, and my exception occurs when opening the Excel file. I am going to convert my excel to csv and see if that cures the problem.
Thank you for all of your help!


Hi , did you find a way to fix this ?
I am getting exactly the same error as

"Exception calling "SaveAs" with "1" argument(s):"SaveAs method of Workbook class failed"
The script runs fine outside of job agent, it creates an excel workbook, adds data to cells, saves, and closes.
-- My script also runs fine outside of an SQL agent job
-- Also tried the create Desktop folder option as listed earlier
I am not sure what this means, although it consistently fails to complete the script (for different reasons), it does appear to run the script
-- Same for me.

Appreciate any thing you found that made it work ?

cheers
Post #1474815
Posted Thursday, July 18, 2013 6:56 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 9, 2013 11:03 AM
Points: 21, Visits: 140
Hi, I was not able to make it work from my system, however I did get it to work properly by putting the desktop file on the server where the database resides. I also installed the redistributable http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=13255 on that server, after making sure Office was installed there as well.

The job now works as scheduled, but if I try to run it manually from my system I still get the same "opening Excel" error.

Good luck, I know it took a long time and a lot of trial and error for me to find the solution that worked for me. Just keep applying all the suggestions everyone has made and eventually one of them will fit.
Post #1475016
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse