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?
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.
(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.
Or, if you're using the newer interface, go to the Data tab > From Text:
This will pull up a File Open dialog, followed by the same Text Import dialog.
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