justinclift 3 days ago

Do you have the specifics of the failure cases? We (sqlitebrowser.org devs) tend to fix bugs like that when we have a reproducer.

2
PeterStuer 3 days ago

Thx for replying here.

My issue had to do with exporting text fields that have multi-line content and then importing that data into Microsoft Excel. I have quickly looked more deeply into this as for now I used a workaround by exporting to JSON.

Upon investigation it does not seem like sqlitebrowser is doing anything explicitly wrong. It quotes texts correctly when necessary, in my case specifically strings that contain 'LF', and does not do it when it is not needed.

The fault lies with the Excel importer that in this case does not correctly derive that it should use QuoteStyle=QuoteStyle.Csv (it uses QuoteStyle=QuoteStyle.None even when you instructed it to base its derivation on the entire dataset. I do not know if any accommodations on the exporting application can (or should) be made to compensate for Excel's import heuristics failures.

P.S. for those running into the same issue (there seem to be many and I have not seen a solution from a quick Goolge that worked), in Excel when doing the import from CSV, select "Transfrom Data", open up the "Advanced Query Editor" and in the first line you will see something like

let Source = Csv.Document(File.Contents("the path to your CSV file"),[Delimiter="#(tab)", Columns=13, Encoding=65001, QuoteStyle=QuoteStyle.None]), ...

Just replace the QuoteStyle.None with QuoteStyle.Csv and you should be good to go.

My apologies to the sqlitebrowser devteam for my initial misconception.

justinclift 2 days ago

No worries at all. I kind of wonder if using LibreOffice for the initial import -> Save to (say) Excel format would work better, than opening that in Excel?

ie might be easier for people who aren't comfortable changing the default settings in things

PeterStuer 2 days ago

It is a weird bug given that you explicitly select "Import from CSV file" In Excel, so no guessing should be needed.

And it is not an obscure edge case You find many people across different fora asking about this, and the suggedtions they get are impracticle workarounds (remove the LF before importing) or do not work (add an 'instruction' line to the file explicitly declaring a separator such as sep=;).

Routing through LibreOffice might work, but there could be a large overlap between those unwilling to open the advanced editor and those unwilling to install LibteOffice.

Google sheets could be another option to try, but only for those that do not mind their data leaving premise.

thechao 2 days ago

Hey! Thanks! Y'all do great work! Your tool is critical to my ability to keep sane.

justinclift 2 days ago

Awesome, you're welcome. :)