Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Using Python script to refresh excel data connection on Alteryx server

Jes
8 - Asteroid

In order to automate data sourcing, I have an excel file that is connected to an internal Sharepoint list that updates with new data when the data connection is refreshed. The connection to the Sharepoint list is authenticated by using my Windows login. (Had to use excel file as an intermediary, because I couldn't figure out how to connect to Sharepoint list directly from Alteryx)

 

I want this excel file to refresh every day at 8am and am looking to automate this.

 

I wrote Python script using XLwings library to use API connection to refresh the excel data connection, as seen below. 

The Python script runs fine on my local device but when I load the code into Alteryx server using the python tool, the workflow errors out when it comes to reading the excel file.

 

Below is the python script.

Jes_0-1643984132502.png

 

Anyone have success using python to refresh excel data connections in Alteryx server? 

11 REPLIES 11
VijayAnaparthi
8 - Asteroid

Anyone resolved this xlwings issue. If you are resolved then please let me know here.

FreeRangeDingo
ACE Emeritus
ACE Emeritus

I was able to refresh an Excel file using a Python script from my desktop but not from the Gallery.  I went thru Alteryx support, and they told me it isn't possible because of how Excel is designed. They said the Excel task requires an active user session. When running on desktop, you get an active user session. But, for security, Alteryx Gallery only runs as a non-interactive session that does not allow for interactive processes. Therefore, it didn’t matter what package or code I used. It would not work, and you cannot perform this task from a workflow run from the Alteryx gallery.

 

I wrote about it here - https://www.bigmountainanalytics.com/automation-with-powerautomate-alteryx-powerbi-excel/.

Labels
Top Solution Authors