There is a way to import a csv file where headers start not from the first line. You just specify the on what line the headers are.
But let's say after I did something with the data table and I want to export it back to the same format, how would I do that? Let's say I have the text, and it is just one line.
So that this CSV in Excel looks like this:
and in a Notepad it looks like this:
Is there a clean way to do that purely in JSL?
The way I'm currently trying to do this:
The opposite operation of reading CSV file I'm doing by reading CSV as a text file into ex, figuring out where my headers start (they can start at different places) and getting the line number as headersLocation, then doing:
dtInt_ = Open(
Char To Blob( ex ),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( headersLocation ),
Data Starts( headersLocation + 1 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
),
Invisible
);
So, my current plan is to get my processed data table into a BLOB somehow, and then just do the opposite Blob To Char() function and prepend some text to it and save it as a CSV file.
I'm stuck into getting data table to blob, so that I could get it to Char (which probably not the right way), or somehow get the data table to CSV format as a text (not save as a file).
Alternatively, I can save it to a CSV file, then read that file back as text and prepend a line and save it again (deleting temporary CSV file) - but it seems to be a very awkward way of doing this.
Thanks,
M.