This tutorial demonstrates how to open a text file in Excel and Google Sheets.
Open Text File in Excel
- In the Ribbon, select File > Open > Browse, and then select the text or CSV file to be opened.
The Text Import Wizard opens to the first of three steps.
- Depending on the data contained in the file selected, you can either choose Delimited or Fixed Width as the file type. If the data is separated with a character like a comma, semicolon, space, or tab, select Delimited. If the first row of data contains column headings, check My data has headers.
- Click Next.
- In Step 2, select the type of delimiters contained in the text file – in this case the tab delimiter. Then select the text qualifier. In some cases, the data may be enclosed in quotes, but for this example, (none) is selected as the text qualifier.
- Click Next.
- The final step of the text import wizard allows you to specify the data type contained in each column. Most of the time, Excel is able to determine the data type automatically, and you can leave the selected Column data format on General.
- Click Finish to import the data into Excel.
Import Text File Using Get Data
An alternative way of importing data into Excel from a text file, is to use the Get and Transform Data feature.
- In the Ribbon, select Data > Get and Transform Data > From Text/CSV.
- Select the file to be imported, and then click Import.
- The file appears in a dialog box with the delimiter already automatically selected, and the text divided by Excel according to the data stored in the text file. Click Load to load the data into Excel.
The data now appears in a new sheet in Excel. There are now two new tabs on the Ribbon – Table Design and Query – as well as a Queries & Connections pane appearing on the right-hand side of the screen. This shows that the data is linked to the TXT file and if any data in the TXT file was to change (external to Excel), the data displayed in Excel would change too.
- To unlink the imported data from the external TXT file, in the Ribbon, select Table Design > External Table Data > Unlink.
- The data is imported into Excel as a table. To convert it to a standard Excel range, in the Ribbon, select Table Design > Tools > Convert to Range.
Both the Table Design and Query tabs on the Ribbon disappear.
Open Text File in Google Sheets
- From the File menu in Google Sheets, select Import.
- Click Upload, and then click on the blue Select a file from your device button to select the required file.
The name of the file to be imported is displayed under File with the default options available for importing automatically selected.
- To change the Import Location, click the drop-down list under Import Location and select the option required.
To change the Separator type, click the drop-down list on the right and select a character to delineate by.
- Keep Convert text to numbers, dates, and formulas checked and then click Import Data to import the file into a new Google sheet.
- Click Open now.