Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Using Windows Task Scheduler to Copy Excel Spreadsheet

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello:

On Windows Server 2008 R2, we use Task Scheduler to copy an Excel spreadsheet from one folder to another on that server's C drive.  

The scripting at the end of this posting is an excerpt from the *.bat file that is used by Task Scheduler to conduct this copying.

Our end user places a spreadsheet in the first directory specified in the scripting.  Then, Task Scheduler uses the scripting to copy the spreadsheet to the new directory and renames the spreadsheet to "SpecialAPLoadInput.xlsx".

Up until a few weeks ago, there were no issues.  This copying, in fact, has been working for years.

Now, the copy of the spreadsheet will not open in the directory that it is copied to.

In fact, upon trying to open the copy, we get the message "Excel found unreadable content...".  In fact, if I copy that spreadsheet from the "new" directory to my laptop's Desktop and try to open it, I get a similar error.

So, instead of relying on Task Scheduler to copy the spreadsheet, I have to ask the user to e-mail the spreadsheet to me.  Then, I manually copy and paste the spreadsheet into the directory and rename it myself.  At that point, the spreadsheet can be successfully opened and used by our application that imports data from the spreadsheet.

One thing that I have noticed that happens consistently is that, no matter how big the original Excel spreadsheet is, the copying creates a copied file that is only 2KB in size.  It's as if Task Scheduler is starting the copying of the file, doesn't quite finish the copy, and we're left with a useless and ultimately corrupt copy of a spreadsheet.


Why would an Excel spreadsheet copied into a folder by Task Scheduler become corrupt, especially after years of successfully using this process?

Thanks!

John

Copy "C:\Scripts\OnDeck\SpecialAPLoad\*" "C:\Scripts\Input\Special APload\SpecialAPLoadInput.xlsx" /y

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Using Windows Task Scheduler to Copy Excel Spreadsheet

    Update:

    I solved this by switching from copy to xcopy to perform the copy.

    Thanks!

    John

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,387 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans