- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
how to save .csv and zip/compress the csv file with jsl
hi, all
anyone know how to save .csv and zip/compress the csv file with jsl? Is it possible at all?
thanks!
Evan
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to save .csv and zip/compress the csv file with jsl
dt = Open( "$sample_data/big class.jmp" );
dt << save( "$temp/deleteme.csv" ); // create a temporary CSV
csvtxt = Load Text File( "$temp/deleteme.csv" ); // and load it as text
ziparchive = Open( "$temp/deleteme.zip", "zip" ); // open a new or existing ZIP
Show( ziparchive << dir ); // old members
actualname = ziparchive << Write( "bigclass.csv", csvtxt ); // add new member
Show( ziparchive << dir ); // the new name may change if conflict
restore = ziparchive << read( actualname, Format( blob ) ); // read the new member
path = Save Text File( "$temp/deleteme2.csv", restore ); // put back on disk
Open( path ); // finish the round-trip by opening
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to save .csv and zip/compress the csv file with jsl
dt = Open( "$sample_data/big class.jmp" );
dt << save( "$temp/deleteme.csv" ); // create a temporary CSV
csvtxt = Load Text File( "$temp/deleteme.csv" ); // and load it as text
ziparchive = Open( "$temp/deleteme.zip", "zip" ); // open a new or existing ZIP
Show( ziparchive << dir ); // old members
actualname = ziparchive << Write( "bigclass.csv", csvtxt ); // add new member
Show( ziparchive << dir ); // the new name may change if conflict
restore = ziparchive << read( actualname, Format( blob ) ); // read the new member
path = Save Text File( "$temp/deleteme2.csv", restore ); // put back on disk
Open( path ); // finish the round-trip by opening
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to save .csv and zip/compress the csv file with jsl
the last two lines can be simplified:
open(restore,"text");
The blob data from the ziparchive object can be opened directly with the "text" argument.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to save .csv and zip/compress the csv file with jsl
More about JMP's zipArchive object: Load Compressed Data