[Solved] Export to CSV - Add ; at the end of each line

Discuss the spreadsheet application
Post Reply
pyo
Posts: 2
Joined: Wed Sep 05, 2018 2:30 pm

[Solved] Export to CSV - Add ; at the end of each line

Post by pyo »

Hi guys,

I am preparing a CSV file according to the bank's specs (exporting sheet with a list of transfers).
2 issues here:

1/
I cannot find any way to have ; (semicolon) at the end of every line.
Semicolon is the field delimiter here - and obviously divides every cell - but doesnt show up after the last cell of each line.
Is there any way to fix it? Or add ; in every line in some other way?
(there are too many lines and too many files to make it by hand)

2/
I need to have every cell quoted - I do have "Quote every cell" checked at export panel.
But there are 2 columns that are empty - no string nor value in these cells - and Calc doesnt qoutes them
In the csv file as a result for this cols I need: ;""; but have only: ;;
I cannot have space there.
Is there any way to force Calc to add the quotations marks for empty cell?
Last edited by MrProgrammer on Thu Dec 02, 2021 4:34 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved]
Apache Open Office 4.1.5 / WIN10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Export to CSV - how to add ; at the end of each line

Post by Villeroy »

If your csv has a header row on top, append an additional header which appends another column of empty cells represented by a trailing semicolon in each row.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Export to CSV - how to add ; at the end of each line

Post by Villeroy »

And formula ="" creates an empty string.

Code: Select all

"ID";"PID";"CID";"D";"V";"X"
0;4;4;06.11.2005;303,63;""
1;2;1;07.04.2008;586,93;""
2;6;2;19.05.2007;80,3;""
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
MrProgrammer
Moderator
Posts: 4905
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Export to CSV - how to add ; at the end of each line

Post by MrProgrammer »

pyo wrote:I am preparing a CSV file according to the bank's specs (exporting sheet with a list of transfers
First File → Save As → File type → ODF Spreadsheet → ✓ Automatic file name extension → Save (to preserve the original content)
After that, File → Save As → File type → Text CSV → ✓ Automatic file name extension → Save then File → Close

Using Writer, create a new, empty text document then Insert → File → «your saved CSV file» → Open
pyo wrote:I cannot find any way to have ; (semicolon) at the end of every line.
Edit → Find & Replace → More options, check Regular Expressions, Search for .+ (period, plus), Replace with &; (ampersand, semicolon), Replace All. I recommend unchecking Regular expressions, before clicking Close.
pyo wrote:But there are 2 columns that are empty - no string nor value in these cells - and Calc doesnt qoutes them In the csv file as a result for this cols I need: ;""; but have only: ;;
Edit → Find & Replace → More options, uncheck Regular Expressions, Search for ;; (semicolon, semicolon), Replace with ;""; (semicolon, quote, quote, semicolon), Replace All, Close.

Save the repaired CSV file with Writer, File → Save As → Type type → Text. If you need any additional assistance attach a document demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself).

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Post Reply