Hi There,
The below is a little confusing - to clarify, I have a zip file with a TSV file in it. The TSV file ends in CSV where it should probably end in TSV.
I'm playing with GDELT data and want to do a bulk insert of file data into a SQL database. To do this I'm exporting a CSV file that is inside a zip file (supplied by GDELT). I have included one of these files, just rename the attached file to "20230101.export.CSV.zip".
I use this code to extract the TSV file from the zip file so I can use it in a bulk insert query (the TSV file ends in CSV where it should probably end in TSV):
Export["20230101.export.CSV", Import[
"20230101.export.CSV.zip", "20230101.export.CSV"] , "TSV"];
In the resulting file, each row is now enclosed by a " at each end (and the bulk insert fails since the file is not properly formatted).
If I rename the file within the zip file to "20230101.export.TSV" and export it using similar code it works properly and does not enclose each line with "".
Firstly, is this a bug? I would have expected Mathematica to export this properly since I added "TSV" in the export statement.
Since the files (inside the zip files) that are supplied have a slightly misleading "CSV" filetype ending (even though they are really TSV files), I am kind of stuck with this naming convention. Any suggestions on how I can get a properly formatted TSV file that I can use for bulk inserts?
Regards,
Sean.
Attachments: