1
Given a raw csv file:
$ cat foo.csv
foo, bar
buzz, "quoted string"
If I open this one with Libre Office with these settings, I can view it nicely. Yet if I select the entire document again and copy it, the clipboard contains:
foo bar
buzz quoted string
I was expecting the clipboard to restore the raw csv again.
The example is very contrived, yet background is that I want to only export a sub fraction from a larger csv without having to cherry-pick via sed
or using
head -n 1 > example.csv
cat large.csv | grep SOME_CODE >> example.csv // sometimes the filter is not as easy
I like to use LibreOffice Calc as it offers a nice filter feature through Data > Autofilter
making it easy to find the lines I want to use. Yet extracting that selection is not as straightforward.
I will use the smaller file for setting up a unit test, which is why I don't want to change the format of the csv file even if it most likely wouldn't make much of a different given a proper csv parser.
As the point of the unit test is to make sure it parses the actual format properly, and I don't want to test against LibreOffice's understanding of a CSV file.
How can I maintain the raw formatting when copying from a CSV file in LibreOffice Calc?