Replace the delimiter in a .CSV file

A common problem with bank statements - I will say no more… :rolleyes:

Also, the decimal character used in the US is a dot, while in Europe we use a comma. You get the picture. :wink:

So, my version of the script to solve this simple problem is very simplified - just replacing the old delimiter/decimal sign with the desired one. In the example below, a semi-colon is replaced with a comma.


on run {input, parameters}
set MyString to input as text
set text item delimiters of AppleScript to ";"
set MyString to every text item of MyString
set text item delimiters of AppleScript to ","
set MyString to MyString as text
return MyString
end run

I use it in an Automator workflow, so the input is provided by the automation.

Problems I faced while using it - the notorious ‘whitespace’. Some banks spit a statement full of whitespace and you cannot process it properly. So, you’ll need to replace the whitespace first using the script above, and then to deal with replacing the delimiter or decimal signs.