Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!

Excel File Compression

Highlighted
6 - Meteoroid

Hey Hobbits,

 

What are the possible steps for  converting a file in  .xlsx format to .zip.

Highlighted
Inactive User
Not applicable

Write the file out and then use that filepath and call powershell or cmd using the Run Command tool to compress/zip it. An example of the command:

 

powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('\\server\drive\filelocation', '\\server\drive\filelocation2\Test.zip')}"

Highlighted
Alteryx Alumni (Retired)

Hi @Bilbo_Baggins,

 

Not quite what you are asking for but,as XLSX format is already compressed, adding ".zip" to the file extension (ren %source_path% %target_file% or move %source_path% %target_path% via Run Command tool) could also be an option.

 

Thanks,

 

Paul

Highlighted
16 - Nebula
16 - Nebula

Or you could use a python zip library if you want to zip multiple different files into one compressed archive.