I have an arcpy Python script that downloads an Excel spreadsheet and then copies one of the sheets from the document to a table in a geodatabase. I need this script to run automatically every night, unattended, and so have it configured from the Windows Task Scheduler.

The script runs fine when run directly from the IDE.

When run from the Task Scheduler (as the same user) it can see the Excel file, but it cannot see any of the sheets within the file. Ie...

  • os.path.exists(filepath) returns True
  • arcpy.Exists(filepath) returns True
  • arcpy.Exists(os.path.join(filepath, sheetname)) returns False when run from Task Scheduler (but returns True when run from IDE as the same user)
  • arcpy.ListTables() returns [ ] (empty list) when run from Task Scheduler (but returns a list of all the sheets when run from IDE as the same user)

The same problem occurs when run from the Task Scheduler whether it is configured to run only when user is logged in or run whether user is logged in or not.

Why can my script read the contents of the Excel file when run interactively, but not when run from the Task Scheduler?

I'm confident that it is not a permissions issue, because the script reads the same file just fine when run from the IDE as the same user for which it is run from the Task Scheduler.

Some Things I've Tried:

I have tried the solution to many posted problems that appear similar. Ie to create the following directories:

C:\Windows\System32\config\systemprofile\Desktop C:\Windows\SysWOW64\config\systemprofile\Desktop

However, I believe that this is only for opening an Excel file in Excel itself. It certainly did not resolve the problem for me when trying to read an Excel file with arcpy.

I also tried the solution for the question at: https://superuser.com/questions/622507/windows-task-scheduler-wont-run-file-on-non-system-drive

Ie, to give explicit permissions for the user to the file's directory, and not just relying on the group permissions. But this did not help either.

  • What is arcpy.env.workspace set to when you use ListTables?
    – PolyGeo
    Nov 2, 2018 at 0:04
  • It is set as: arcpy.env.workspace = filepath . It works fine when run interactively from the IDE, as it lists all of the sheets in the spreadsheet then. Nov 2, 2018 at 0:38
  • Did you include the '$' at the end of the sheet name? Are you running Task scheduler on the same machine as the IDE? Same version of arcgis?
    – Fezter
    Nov 2, 2018 at 0:54
  • Yes, the '$' is included, it is running on the same machine (and same ArcGIS). Nov 2, 2018 at 0:57
  • I found this as well. Changing working directory.
    – Fezter
    Nov 2, 2018 at 1:10

1 Answer 1


Changing the task's Action in Task Scheduler to use 32 bit Python instead of 64 bit Python resolved the problem.

I realised that my IDE was using 32 bit Python ( C:\Python27\ArcGIS10.5 ) but my Task Scheduler task was configured with 64 bit Python ( C:\Python27\ArcGISx6410.5 ). I changed the task to use the 32 bit Python and now it works.

I do not yet understand why this is. If anybody else has any insight (or if anybody can replicate the problem), I'd be glad to hear it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.