Exporting to Excel using Task Scheduler

Reply
Occasional Contributor
Posts: 15

Exporting to Excel using Task Scheduler

Good morning all! I have a set of code that runs automatically once a week through Microsoft Task Scheduler. At the end of the code I have this...

/*Export file to a folder*/

libname SASXLS "\\team\company\Business Development\Monthly Reports\MKT_Roster_%sysfunc(today(),yymmddn8.).xlsx";

data SASXLS.MKT_Roster; set roster; run;

libname SASXLS clear;

If I run the code manually - meaning, while I am sitting here watching it, the file exports just fine. But on Task Scheduler, I get this error:

ERROR: The MS Excel table MKT_Roster has been opened for OUTPUT. This table already exists, or

       there is a name conflict with an existing object. This table will not be replaced. This

       engine does not support the REPLACE option.

Is there a different way to run this export code so it will work with Task Scheduler?

Valued Guide
Posts: 3,208

Re: Exporting to Excel using Task Scheduler

Try to run that same program but whit a open local destination on your own machine.  (C:\?)
It could (mos likely) be the unc name \\tema\compnay\....  is not accessible in the session context started by your batch script and it in your normal interactive one  

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 1 reply
  • 155 views
  • 0 likes
  • 2 in conversation