Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

Excel File Compression

Bilbo_Baggins
6 - Meteoroid

Hey Hobbits,

 

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

3 REPLIES 3
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')}"

PaulN
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

SeanAdams
17 - Castor
17 - Castor

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