I want to import a CSV file to Excel. The CSV file has comma separated data (go figure), but the delimiter in the Text Import Wizard is set to "Tab" by default. How can I change the default to "Comma" instead?
-
1fergulator has an answer that works wellpypmannetjies– pypmannetjies2012年10月30日 14:19:59 +00:00Commented Oct 30, 2012 at 14:19
3 Answers 3
This is a Windows setting that will be used by all programs that refer to it (Excel in this case).
- Click the Start button, and then click Control Panel.
- Open the Regional and Language Options dialog box.
- Do one of the following: In Windows Vista/7, click the Formats tab, and then click Customize this format. In Windows XP, click the Regional Options tab, and then click Customize.
- Type a new separator in the List separator box.
- Click OK twice.
-
7This doesn't works...Stormenet– Stormenet2011年09月16日 08:33:04 +00:00Commented Sep 16, 2011 at 8:33
-
3It works when you use the normal file->open procedurepypmannetjies– pypmannetjies2012年10月30日 14:19:23 +00:00Commented Oct 30, 2012 at 14:19
-
Excel ignores this locale setting for common data file extensions like
.datand.txtpatricktokeeffe– patricktokeeffe2015年08月21日 20:12:07 +00:00Commented Aug 21, 2015 at 20:12 -
1An additional solution is to start your csv files with sep=,\n This will allow users of all Language Options to read the file but dots will not automatically be used as the fixed point digit seperator so numbers might be very wrong!Oliver Zendel– Oliver Zendel2017年03月19日 13:43:46 +00:00Commented Mar 19, 2017 at 13:43
(Assuming the Office 2003 interface)
Don't use File> Open.
Instead use Data> Import External Data> Import Data...
This will invoke the Text Import Wizard, which lets you choose the delimiter. Text Import Wizard - Step 1 Text Import Wizard - Step 2
Or, if you're using the newer interface, go to the Data tab > From Text:
Text Import 2007
This will pull up a File Open dialog, followed by the same Text Import dialog.
-
13Yes, I am aware of the Text Import Wizard, I should have mentioned it in the question, not just the title. What I want to do is change the default from "Tab" to "Comma" in that wizard. Its a pain to have to change it when I never have tab delimited imports.Lars– Lars2011年06月01日 11:13:20 +00:00Commented Jun 1, 2011 at 11:13
-
@Lars: datatoo's pointer to Dave Peterson's solution works perfectly well for me.PonyEars– PonyEars2014年01月09日 01:56:57 +00:00Commented Jan 9, 2014 at 1:56
-
Works for Excel 2017 on the Mac as well ;-)Giel Berkers– Giel Berkers2017年10月13日 12:34:20 +00:00Commented Oct 13, 2017 at 12:34
Excel appears to use the last used delimiter in the session. Dave Peterson describes a possible solution here You essentially create a macro that sets the default delimiter and place it in the xlstart folder. If you are doing this for a file on other peoples machines, that is not probably going to work, but this is how you would approach it, programatically on your own system, and you may adapt it to your situation. Running the following code should set the delimiter for you beforehand. This will operate on an existing session. So if you have content that expects specific delimiters setup, run something like this prior to your import, setting whatever parameters you like
With ThisWorkbook.Worksheets(1).Range("a1")
.TextToColumns Destination:=.Columns(1), DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, Comma:=True, Space:=False, Other:=False
End With
ThisWorkbook.Close SaveChanges:=False
-
3It does not use the last one on my system I have to change it every time -- even if I just changed it in the same workbook.Hogan– Hogan2017年08月11日 19:18:57 +00:00Commented Aug 11, 2017 at 19:18