We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Write Excel file to local drive from Gallery w/ Python?

Nicholas_White
8 - Asteroid

Hello,

 

My Setup
Below is my Workflow, it lives in the company's Gallery:

vitaminman12_0-1675985692079.png

1. It has a File Input which asks for an Excel file (some_file.xlsx)

2. it extracts some FileName information from the file (filename, sheetname, local path)
3. it passes both the data and the FileName information from the Excel file into the Python Tool

4. The Python Tool does some stuff to the data, creates a new Excel file, and writes it out as a new Excel file (some_new_file.xlsx).

My Issue

When I run this Workflow on my local machine, it runs fine, I get some_new_file.xlsx to appear in the folder where some_file.xlsx exists.

 

When I run this in the Gallery, I get nothing. I think it's writing out a file, but I have the suspicion that it is being written to some folder on the Gallery's physical server.

What I Would Like

I would like that the Python Tool either write some_new_file.xlsx directly to the same directory where some_file.xlsx was loaded from, or I would like the Gallery to prompt the user to download the results as an .xlsx file.

Is this possible with Python spitting out the Excel file?

Thanks,

 

Nick

 

11 REPLIES 11
Nicholas_White
8 - Asteroid

Hi @RenaFR ,

 

Please see attached workflow. It's a really stripped down version of my original workflow, I can't share the original because it contains sensitive information.

 

In a nutshell, I have two inputs to a Python tool: a filename input, and a raw_data input..

 

The Python tool brings in raw_data as a Pandas dataframe, writes the dataframe to an Excel file, and writes the Excel file back to disk using a modified version of filename as its name.

 

The Python tool also takes note of the path where the Excel file is stored on your disk, passes path back out to the Blob Tool.

 

The Blob tool collects the Excel file located at path and returns it to Alteryx.

 

When I have used this setup within an Analytic App, or when I run it in the Gallery, I get a prompt to open/download the Excel file.

Nicholas_White_0-1683128017061.png

 

 

Please let me know if this doesn't work for you.

Nick

AndreeaR
5 - Atom

Hi Nick,

Thanks for sharing your workflow with us. I've been trying to export the results from the python tool to an excel file and this example was really helpful. I have an error though, it seems that the import of xlsxwriter does not work. Do you know if I need to have an active MS Office license for that? I'm running Alteryx on a virtual machine and the license is active on my local machine. Thanks!

Labels
Top Solution Authors