This post was most recently updated on March 13th, 2023.
6 min read.This article will explain how you can change the Excel list delimiter for your CSV (or other) file exports. Because it isnât always a comma. And setting the delimiter wonât escape or strip the same characters in the values, so itâll mess up your data quite easily.
Recently, I needed to find a way to import data from an old Excel file to a custom-coded system that could import CSV files. However, the data was fairly non-sanitized â containing commas, semicolons, and other weird characters. I could define the delimiter used in the imported data â however, that would be useless if I wasnât also able to define it in the export.
With Excel, itâs not that simple, though. Excel, just like other Microsoft Office applications loves trying its best to respect the regional & localization settings of the machine itâs running on â most often to frustrating results.
Which just means you can change the delimiter value used in CSV export by tweaking these settings. This way, you can change the commas to semicolons, or save the CSV with any other delimiter.
And this article describes how!
Another day, another workaround. If youâre not interested in the background stuff and WHY I ran into this issue, just click to jump right down to the actual solution:
How to export a CSV with a custom delimiter using Microsoft Excel
Background
If youâre still here, letâs delve into the background of the issue a bit deeper.
I needed to wrangle data stored in a .xlsx file into another form, that another application could read. This file format happened to be CSV. Which brought me into the beautiful world of CSV delimiter configuration in Windows.
Normally, thatâs simple â just âsave asâ with a different file format. However, this time I was posed with an issue: the data included both commas (â,â) and semicolons (â;â), both of which are typical delimiters in CSV files. Additionally, I couldnât wrap the values inside quotes due to limitations in both the export and the import functionality. So I needed to use another character â such as pipe (â|â).
Instead of being able to configure the delimiter in the export (like in any sensible spreadsheet editor, if you ask me!), Excel is just going to use your regional settings and grab the list separator from there. Nice and automatic â probably someone thought this to be user friendly, but instead it makes edge cases a pain.
This means that in English, CSV is going to be values limited by commas, like this:
Value1,Value2,Value3,Value4...
But in Finnish, for example, weâll be using the semicolon â like so:
Value1;Value2;Value3;Value4...
And I could imagine there are plenty of other locales where you might need to tell the values apart with a semicolon instead of a comma. Or you might even need something totally different!
But simply changing my region to something else isnât a solution this time. The data I had been supplied had both colons and semicolons in cell values. The data would be incorrectly split and parsed due to that.
However, we can luckily override the delimiter to be almost anything â and itâs all done through the regional settings. Read on to see for yourself!
Solution
So, I started googling. And naturally, I found a couple of examples on how to save a csv file with a different delimiter in Windows 7⊠Obviously, thatâll help you eventually find your way in Windows 10 or Windows 11 as well, even though the user interfaces are a bit different. But I thought itâs always useful to also document the exact steps!
The guide below should be accurate for Windows 10 and 11, and be âclose enoughâ for Windows 7. :)
Here are the steps for saving a csv in Excel with a different delimiter, in writing â and see some useful screenshots further below!
Time needed:Â 10 minutes
How to export a CSV with a custom delimiter in Excel?
- Make sure Microsoft Excel is closed before trying to change the CSV delimiter
Making sure Excel is closed is required to make sure it picks up your changes.
- Open Control Panel
Opening the Control Panel can be done by hitting win+r and writing âControl Panelâ in the Run window.
Or by searching for âControl Panelâ in your start menu. Whichever suits you. - Next, you need to access Regional Settings
Now youâll need to navigate to Regional Settings.
This is where you can find it:
Itâs available either under âRegionâ or âClock and Regionâ -> âRegionâ. - Click the âAdditional settingsâ -button
Hit that âAdditional settingsâŠâ -button now! This will pop up quite a few additional options â in hindsight, not that surprising, but itâs always nice when a button does what you expect it to do.
- Find the âList separatorâ and change it to your preferred delimiter such as a pipe (â|â).
Youâll need to edit the âList separatorâ now.
While the dropdown might have some prepopulated values, you can actually just safely ignore them and input whatever delimiter you need to use to the text field directly.
Note, that thereâs at least one, undocumented limitation here: you canât use the same character as both decimal and list separator! This means that if youâre using regional settings like Finnish, where a comma is considered to be a decimal separator instead of a full stop or âdotâ, you canât use it as a list delimiterâŠ
Before you change the decimal separator to something else, that is :)
This also doesnât come without some side effects: the same list separator is used, for example, as the separator for passing parameters to an Excel function, as Faz notes in the comments section below. - Click OK -> OK -> exit Control Panel, after which you can proceed to actually export the file!
With the selection done, just hit âOKâ a couple of times and head back to Excel!
Now we can retry saving the file! - Open the Excel file
Open the file you want to export to a CSV with a custom delimiter (in my example, to a âpipe-delimited fileâ).
- Select File -> Save As
Time to save the file! Hit File > âSave asâ. This should pop up the classic saving dialog â which in Excel comes with some useful options.
- Change the âSave as typeâ to âCSV (Comma delimited)(*.csv)â
Changing to âCSV (Comma delimited)â is admittedly a bit misleading at this point, but weâll just have to live with that. It will in fact respect your selected delimiter despite the name.
- Change the name and file extension if need be
You can modify the extension and the file name, but by default, it stays as csv even if youâre using a different delimiter.
- Click Save -> OK -> Yes
After hitting a couple of extra affirmative buttons, you should be good!
So now you know how to save (or export, if you prefer that term) a CSV file with a custom delimiter (anything different than a comma or semicolon, depending on your machine configuration) in Microsoft Office Excel on Windows. If you run into any questions, drop them in the comments-section below!
As an interesting side note, you can use completely nonsensical characters as delimiters! Take the picture below as an example â I actually needed this delimiter for a work project once. A project, thatâs probably still running in productionâŠ
If you search for this online, youâll get the easy answer â a comma. Itâs âcomma-separated valuesâ after all, right?
Well, as usual, the easy answer is wrong. You can even find it on support.microsoft.com. But itâs still the wrong answer.
The default delimiter is defined by your Windows locale. Itâs usually either a comma or a semi-colon, but itâs not necessarily one of those. It can be something different, too. Just so you know.
Because Microsoft wants to implement localization everywhere but doesnât actually care about people using any other locales than EN-US. ð
References
Big kudos to Barry Stevens for his blog post on the topic! And also to Sami Laiho, for noticing you canât use the same character as both decimal and list separator ð¬..
- âPerforming cleanupâ â Excel is stuck with an old, conflicted file and will never recover. - November 12, 2024
- How to add multiple app URIs for your Entra app registration? - November 5, 2024
- How to access Environment Secrets with GitHub Actions? - October 29, 2024