Free Trial

Alteryx Designer Desktop Discussions

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

Creating a downloadable output via the Python tool

tristank
11 - Bolide

Hello all!

 

I am using openpyxl to generate and format an Excel file within the Python tool. I would like to be able save the Excel file within the script so that it is downloadable via a Gallery app.

 

Ignoring the openpyxl for a moment, just testing with a CSV I have:

 

1. Relative output: dataframe.to_csv(file_name)

2. Using os to pull the temp directory to make sure it is outputted there

3. Used Alteryx.getWorkflowConstant("Engine.WorkflowDirectory") to force the output to go where the workflow exists

 

No matter what I do I can't get the file to be downloadable, either locally or in gallery. The file does output to the temp location or the workflow location (depending on my options above) but that is it.

 

Thanks for any assistance <3

5 REPLIES 5
binuacs
21 - Polaris

@tristank have you checked whether the "Engine.WorkflowDirectory" giving the path whether the workflow located?

from ayx import Alteryx


# Get the directory path of the current workflow
workflow_directory = Alteryx.getWorkflowConstant("Engine.WorkflowDirectory")
print("Workflow Directory:", workflow_directory)

 

tristank
11 - Bolide

@binuacs here is a sample of my tests with the 'Engine.WorkflowDirectory'

 

When I run it locally as an app the file gets dropped in the workflow location but there are no downloadable output files :/

 

 

 

 

 

biju_blackline
5 - Atom

Were you able to download the file from server finally ? I am also facing the same scenario

GMG0241
8 - Asteroid

I think you have to trick the workflow into thinking it's created the most recent output for the file. To do this, you're first action is to use the output data tool to create your desired file. Next, you're going to run the python and then the workflow will generate a downloadable output file message. I've attached an example workflow to demonstrate what I mean

apathetichell
19 - Altair

@GMG0241is on the right track - the core issue to get this to work on Server is that Alteryx tracks what output it creates and provides them to users at the end of a workflow - and everything else should be ephemeral. This means two things:

1) if you are creating a file in the python tool -  and not saving it to a specific location - ie a network drive -it's ephemeral and will not be downloadable (at least not easily).

2) you need to get the location of your file AFTER you create in the python tool. you then will need to read in the file via standard blob input tool -> and output the file via standard blob output tool after you create it in our workflow.

Labels
Top Solution Authors