Connect to a Text file (Power Query)

Use Excel's Get & Transform (Power Query) experience to connect to Text files.

Click the Data tab, then Get Data > From File > From Text/CSV. If you don't see the Get Data tab, click New Query > From File > From Text.

In the Power Query ribbon tab, click From File > From Text.

Power Query From File dialog

See the following video on how to display Query Editor.

Note: The Query Editor only appears when you load, edit, or create a new query using Power Query. The following video shows the Query Editor window appearing after editing a query from an Excel workbook. To view the Query Editor without loading or editing an existing workbook query, from the Get External Data section in the Power Query ribbon tab, select From Other Sources > Blank Query. The following video shows one way to display the Query Editor.

How to see Query Editor in Excel

Next

  1. In the Browse dialog box, browse for or type a file path to import or link to a file.

After the connection succeeds, you will be able to preview the lines of text in the file.

Formula Example

You can also use the Query Editor to create formulas to connect to text files. For example:

= Table.FromColumns({Lines.FromBinary(File.Contents("C:\sample.txt"),null,null,1252)})

Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.

See Also

Power Query is known as Get & Transform in Excel 2016

Import data from external data sources

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×