Blog Post
PowerPivot - Import from text file with non-standard delimiter
Author
Mandy Doward
Date
April 12, 2016
Length
2 mins
Last week while teaching a PowerPivot course I was asked if it was possible to import data into a Power Pivot table from text files with non-standard delimiters.
The answer is – YES!!
ODBC Desktop Text File Driver
PowerPivot uses the Microsoft ODBC Desktop Database Drivers.
The Text File Driver is the driver used to import data from text files.
The Text File Driver supports the use of a schema.ini file, located in the same folder as the text source file, which can be configured to define delimiters, language and data type settings.
schema.ini File
Here is a sample dat file called data1.txt:
As you can see the field delimiter for this file is an exclamation mark (!).
When you launch the Power Pivot import from text file the following delimiters are on offer as standard:
To successfully import the records from dat1.txt into a PowerPivot table we must create a schema.ini file in the same folder as data1.txt and the file should contain the following lines:
When the flat file import is attempted again the Text File Driver will locate the section in the schema.ini file that matches the specified file name and will import accordingly. We can see in the file above that the delimiter has been set to an exclamation mark. The screen shot below shows that the fields have been interpreted correctly:
Although the dialog still shows a comma as the selected delimiter, the delimiter setting has been taken from the schema.ini file.
Want to learn more about Excel PowerPivot? Take a look at our Excel PowerPivot training course.
Share This Page
Mandy Doward
Managing Director
PTR’s owner and Managing Director is a Microsoft MCSE certified Business Intelligence (BI) Consultant, with over 30 years of experience working with data analytics and BI.
PTR FAQs
See our FAQs or get in contact for more information on any of our services, solutions, or to start your PTR journey.