Semicolon instead of comma in Table exportToCSV?

Hi, i am exporting a table to CSV,
But i have noticed that using a swedish Excel, all rows ends up in one column, instead of splitting up the data with the comma.
In sweden we uses comma (,) to seperate decimals, and swedish Excel wont split when open an CSV-file that is comma-separated.

Can i get the export function to use semicolon instead?

Not OK format:

"dateDay","OK","NOK","Total" "2016-08-15","3","0","3" "2016-08-16","5","11","16" "2016-08-17","8","3","11" "2016-08-18","11","2","13"

OK format:

"dateDay";"OK";"NOK";"Total" "2016-08-15";"3";"0";"3" "2016-08-16";"5";"11";"16" "2016-08-17";"8";"3";"11" "2016-08-18";"11";"2";"13"

You could work around this with the system.dataset.toCSV function and some string replacement:

table = #my component reference to a table ds = csv = system.dataset.toCSV(dataset=ds, showHeaders=True, forExport=False) csv = csv.replace('","', '";"') path = system.file.saveFile("TableExport.csv") if path != None: system.file.writeFile(path, csv)

This is not perfect because if you had a string column with a value that contained a literal “,” in the data, it would break the comma to semicolon mapping, but this should do fine with the vast majority of data.

1 Like

Thanks, this worked as expected, and the texts and values will not have commas in them, values is always an integer in this case.