community
cancel
Showing results for 
Search instead for 
Did you mean: 

Dev Space

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

Excel File Compression

Meteoroid

Hey Hobbits,

 

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

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

Moderator
Moderator

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

Nebula
Nebula

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