intransigent_rocker
intransigent_rocker

Reputation: 73

Is there a way for python to update an excel slicer in non-interactive mode?

I have a python script that refreshes data connections, updates slicers and filters.

I'm using pywin32 to update my excel file. As I understand, updating excel slicers and filters requires COM automation.

This poses a problem for me, because I want to use task scheduler to schedule the script to run regardless of if I'm logged in or not (which runs the task in non-interactive mode).

Running the task in non-interactive mode, will cause my script to fail with the following error (-2147024891, 'Access is denied.', None, None). My script runs successfully in interactive mode, however.

Is there a way to successfully schedule my script to run regardless of if I'm logged in?

Upvotes: 0

Views: 50

Answers (1)

Waaazzzuuuuup
Waaazzzuuuuup

Reputation: 26

Can't know for sure but I'm assuming the script is failing because of missing privileges.

  • If the privileges needed for this to work are some Windows stuff like read/write files or start an app, you likely can bypass it in Task Scheduler Security options for a task - check options "Run whether user is logged on or not" and "Run with highest privileges"
  • If these are some form of file-protection-privileges (i.e. only some identified users can do something with files), then you most likely should directly point the user running this task in the options. But if this type of protection involves some auth token or similar things - I think it won't be possible (because it equals to auto-login as user, which is kinda destroys the purpose).

Upvotes: 0

Related Questions