简体   繁体   中英

Xlwings Excel and Windows Task Scheduler issues

I have a python script that runs perfectly when I manually run the python script. It opens a shared excel file, adds data to the bottom of the sheet in real time with other users in the file, auto saves and closes. However, when I schedule this task with windows task scheduler on windows 10, it opens the file, but does not show other users in the excel file, nor will it auto save.

any ideas on how to get it to open excel properly and update in real time?

wb = xw.Book('Pending Tracker.xlsx')
ws = wb.sheets['Pendings']
val = ws.range('A1').end('down').offset(row_offset=1, column_offset=0).options(index=False, 
   header=False).value = comparison_df
time.sleep(20)
wb.app.quit()

Photo of Task Scheduler Setup

I found the fix to make it work. Hopefully someone else that is having issues with an Excel file that is shared Via OneDrive with multiple users will find this useful. In Task Scheduler, it needed to be run as Windows Server 2003 without Highest Privelages and now XLWings will open the file with other people in it, add information to the bottom of the spreadsheet, auto save and close without kicking other users out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM