How to copy .csv spreadsheet cells with line breaks

Started by wywh, May 31, 2023, 12:15:58 PM

Previous topic - Next topic

wywh

I have used exiftool .csv output to make a backup copy of my movie (and image with different options) metadata with something like:

exiftool -a -G1 -s -n -r -api LargeFileSupport=1 -fileOrder5 FileName -api QuickTimeUTC=1 -System:FileName -MacOS:FileCreateDate -System:FileModifyDate -QuickTime:CreateDate -Keys:CreationDate -Keys:GPSCoordinates -Keys:Make -Keys:Model -Keys:Software -Keys:Author -Keys:DisplayName -Keys:Title -Keys:UserRating -Keys:Keywords -Keys:Description -Keys:LocationName -csv . > out.csv

LibreOffice can open that .csv OK.

But I prefer to further copy and inspect desired columns with a text editor BBEdit (Mac).

But that does not work at least with columns copied from LibreOffice 6-7 (LibreOffice 5 behaved differently):

Bug 119928 - Newline in cell formula are ignored when copy-pasting more than one cell in Calc 6.x

https://bugs.documentfoundation.org/show_bug.cgi?id=119928

A workaround is to paste to LibreOffice Text Document or TextEdit.app (in RTF mode), copy, and paste to BBEdit text editor.

BBEdit 14 has Edit > Columns option but somehow that does not correctly work because it seems to see only the 1st line in a spreadsheet cell.

Am I missing some .csv option?

Sample .csv file attached. Look at the 2nd "Keys:Description" column with 4 lines inside cells.

- Matti

StarGeek

I'm not sure there is anything exiftool can do about this, as the problem is with LibreOffice.  The line feeds just don't seem to be there with the plain text.

With Windows NotePad++, there are options to paste as RTF and HTML and both of those paste the copied cells with the proper formatting, such as <BR> in the HTML paste and \line for RTF, so the line feeds are there in the rich text, just not in the plain text.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

wywh

BBEdit 14.6.6 does not currently handle gracefully .csv that has line breaks mid-cell. The developer investigates the issue but since BBEdit is expressly not a spreadsheet, did not make any promises that there will be a significant change in behavior. Without line breaks mid-cell it handles .csv columns as expected.

So a workaround is to copy from LibreOffice calc to LibreOffice Writer or some app that supports styled text, and then copy that to a text editor like BBEdit or Notepad.

- Matti