Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Output files to ZIP

nsmith293
7 - Meteor

Hello,

 

I have an analytic app that is run by our users via our company's Gallery.  The process is that the user uploads an Excel file and the output is 7 CSV files plus a text file.

 

I want the output to just be 1 zip file containing those 7 CSV files and 1 Text file.  I've seen posts that talk about this but I haven't found anything that works- especially not cleanly.

 

Any ideas on how to accomplish this?

 

Thanks.

8 REPLIES 8
Inactive User
Not applicable

Keep your process as-is. You need to add to it by adding a run command tool to zip those files up. Create the run command to zip using a formula tool and ensure all of those files are sitting in a temp directory that you can zip and ship to where needed. I would suggest using a block until down tool and the 1st step be the writing of those files, then step 2 is to zip them and send them off using command line (Run Command tool).

bharti_dalal
10 - Fireball

Hi @nsmith293,

 

There is a solution to your Question, it definitely will give you the result. once done, you wouldn’t have to do it again and you will get your results.

In order to create zip files, first you need to install 7 zip software. Link: https://www.7-zip.org/

Second Step involves Creation of a Batch file, which we are going to use in Alteryx to create Zip Files.

Batch File: Open Notepad, and write the following codes line by line.

            path c:\Program Files\7-Zip (installed path)

            7z a -tzip “{path where you want to create your zip files. Example: D:\ all_Files.zip}” {space} “{Path where your files are stored}”

Save this notepad at any location by ending *.bat. It will store the file in batch format.

 

image.png

Final step is that in Alteryx go to Developer tab, Drag and drop Run Command, in Run External program (UI), select your batch file, ending with .bat

 

image.png

 

Important Points: Folder location should be different (where you are fetching files and where you are storing zip file) in order to execute this. This program will overwrite existing zip file. Also note that you might have to block until done tool, as this should execute in the last.

I hope this solution will help you out.

nsmith293
7 - Meteor

Thanks for the input on this.  The challenge I have is (1) I need it to run on the server, so any local path references are no good and (2) I need the ability to be dynamic in directory and file name.

 

I'm going to ask my IT team that owns our server, but I was wondering if there was a way anyone knew to do this in a server environment.

 

Thanks.

MarqueeCrew
20 - Arcturus
20 - Arcturus
Can you output to a common network share drive using UNC paths?
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
nsmith293
7 - Meteor

Yes, UNC paths work.   I'm just not sure how to call a zip cmd and support dynamic path/filename definitions. 

 

Thanks.

BPurcell2
9 - Comet

I'm interested to see if anybody can assist on cmd tools on unc paths to use when scheduling on server.

williamchan
10 - Fireball

Hey Everyone,

 

I've just submitted the idea to the Alteryx team. Please give it a vote if you think it should be added.

https://community.alteryx.com/t5/Alteryx-Designer-Ideas/Output-to-batched-zip-file-for-csv-pdf-xlsx/...

 

Thank you.

Felipe_Ribeir0
16 - Nebula

Hi everyone

 

I just submitted this macro to the gallery, it is using the zipfile python library to do this. I am using it with Alteryx Server scheduled.

 

Zip any given files - Alteryx Community

 

INPUT example:

FileToZipZipName
Output.xlsxOutput.zip
SAPExtraction.txtOutput.zip
Report.pdfReport.zip

 

Hope this is useful for you!

Labels