.csv file to .zip file format conversion | Community
Skip to main content
Level 2
May 3, 2024
Solved

.csv file to .zip file format conversion

  • May 3, 2024
  • 2 replies
  • 2425 views

Hello Team,

 

 

I'm looking to convert a single .csv file into a .zip format and then transfer it to SFTP. Could you please assist me with this?

 

 

Thank you.

 

 

Regards, Ankita Vishe

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by LakshmiPravallika

Hi @ankitav3131 ,

 

You can use the below Command to convert .csv file generated using Data Extraction activity to .zip file

 

Please run this command using Java script activity.

 

execCommand('zip -r -j '+vars.directorypathZipFileIsPlaced+' '+vars.filename+'');

 

Here vars.filename refers to the .CSV File generated.

 

Regards,

Pravallika.

 

2 replies

LakshmiPravallika
Community Advisor
LakshmiPravallikaCommunity AdvisorAccepted solution
Community Advisor
May 3, 2024

Hi @ankitav3131 ,

 

You can use the below Command to convert .csv file generated using Data Extraction activity to .zip file

 

Please run this command using Java script activity.

 

execCommand('zip -r -j '+vars.directorypathZipFileIsPlaced+' '+vars.filename+'');

 

Here vars.filename refers to the .CSV File generated.

 

Regards,

Pravallika.

 

Level 2
May 7, 2024

Hi Pravallika,

Thanks for your response!!

Can you just help me with the "vars.directorypathZipFileIsPlaced". What will be the value for this or what will in place of this?

Regards,
Ankita Vishe

AkshayAnand
Community Advisor
Community Advisor
May 7, 2024

Hi @ankitav3131 

 

As Lakshmi has mentioned, "vars.directorypathZipFileIsPlaced" is the directory path where you want to create/place the zipped file created from the .CSV file.

 

For reference, please see the following link.

 

Regards

Akshay

Sukrity_Wadhwa
Community Manager
Community Manager
May 16, 2024

Hi @ankitav3131,

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!

Sukrity Wadhwa
May 16, 2024

I have generated one .csv file and now trying to convert it to zip file and I am using the below script for that but it is giving error (BAS-010076 Cannot execute command 'zip -r -j \\12.34.56\\ABC\test.zip \\12.34.56\\ABC\test.csv' (err=2, the system cannot find the file specified.) . Can anyone help with this?

vars.filename = "\\\\12.34.56\\ABC\\test.csv";[This is the file I already generated through data extraction activity]
vars.directorypathZipFileIsPlaced = "\\\\12.34.56\\ABC\\test.zip";

execCommand('zip -r -j '+vars.directorypathZipFileIsPlaced+' '+vars.filename+'');

I tried with vars.filename = "test.csv"; as well but it didn't work.

Sukrity_Wadhwa
Community Manager
Community Manager
May 23, 2024

Hi @akshayanand & @lakshmipravallika
Can you help @tanmoy7 further with this query or shall this be reported to internal SME's? Do let me know.

Thanks!

Sukrity Wadhwa