What is a text file in excel

Import or export text (.txt or .csv) files

There are two ways to import data from a text file with Excel: you can open it in Excel, or you can import it as an external data range. To export data from Excel to a text file, use the Save As command and change the file type from the drop-down menu.

There are two commonly used text file formats:

  • Delimited text files (.txt), in which the TAB character (ASCII character code 009) typically separates each field of text.

  • Comma separated values text files (.csv), in which the comma character (,) typically separates each field of text.

You can change the separator character that is used in both delimited and .csv text files. This may be necessary to make sure that the import or export operation works the way that you want it to.

Note: You can import or export up to 1,048,576 rows and 16,384 columns.

Import a text file by opening it in Excel

You can open a text file that you created in another program as an Excel workbook by using the Open command. Opening a text file in Excel does not change the format of the file — you can see this in the Excel title bar, where the name of the file retains the text file name extension (for example, .txt or .csv).

  1. Go to File > Open and browse to the location that contains the text file.

  2. Select Text Files in the file type dropdown list in the Open dialog box.

  3. Locate and double-click the text file that you want to open.

    • If the file is a text file (.txt), Excel starts the Import Text Wizard. When you are done with the steps, click Finish to complete the import operation. See Text Import Wizard for more information about delimiters and advanced options.

    • If the file is a .csv file, Excel automatically opens the text file and displays the data in a new workbook.

      Note: When Excel opens a .csv file, it uses the current default data format settings to interpret how to import each column of data. If you want more flexibility in converting columns to different data formats, you can use the Import Text Wizard. For example, the format of a data column in the .csv file may be MDY, but Excel’s default data format is YMD, or you want to convert a column of numbers that contains leading zeros to text so you can preserve the leading zeros. To force Excel to run the Import Text Wizard, you can change the file name extension from .csv to .txt before you open it, or you can import a text file by connecting to it (for more information, see the following section).

Import a text file by connecting to it (Power Query)

You can import data from a text file into an existing worksheet.

  1. On the Data tab, in the Get & Transform Data group, click From Text/CSV.

  2. In the Import Data dialog box, locate and double-click the text file that you want to import, and click Import.

  3. In the preview dialog box, you have several options:

    • Select Load if you want to load the data directly to a new worksheet.

    • Alternatively, select Load to if you want to load the data to a table, PivotTable/PivotChart, an existing/new Excel worksheet, or simply create a connection. You also have the choice of adding your data to the Data Model.

    • Select Transform Data if you want to load the data to Power Query, and edit it before bringing it to Excel.

If Excel doesn’t convert a particular column of data to the format that you want, then you can convert the data after you import it. For more information, see Convert numbers stored as text to numbers and Convert dates stored as text to dates.

Export data to a text file by saving it

You can convert an Excel worksheet to a text file by using the Save As command.

  1. Go to File > Save As.

  2. Click Browse.

  3. In the Save As dialog box, under Save as type box, choose the text file format for the worksheet; for example, click Text (Tab delimited) or CSV (Comma delimited).

    Note: The different formats support different feature sets. For more information about the feature sets that are supported by the different text file formats, see File formats that are supported in Excel.

  4. Browse to the location where you want to save the new text file, and then click Save.

  5. A dialog box appears, reminding you that only the current worksheet will be saved to the new file. If you are certain that the current worksheet is the one that you want to save as a text file, click OK. You can save other worksheets as separate text files by repeating this procedure for each worksheet.

    You may also see an alert below the ribbon that some features might be lost if you save the workbook in a CSV format.

For more information about saving files in other formats, see Save a workbook in another file format.

Import a text file by connecting to it

You can import data from a text file into an existing worksheet.

  1. Click the cell where you want to put the data from the text file.

  2. On the Data tab, in the Get External Data group, click From Text.

  3. In the Import Data dialog box, locate and double-click the text file that you want to import, and click Import.

    Follow the instructions in the Text Import Wizard. Click Help button image on any page of the Text Import Wizard for more information about using the wizard. When you are done with the steps in the wizard, click Finish to complete the import operation.

  4. In the Import Data dialog box, do the following:

    1. Under Where do you want to put the data?, do one of the following:

      • To return the data to the location that you selected, click Existing worksheet.

      • To return the data to the upper-left corner of a new worksheet, click New worksheet.

    2. Optionally, click Properties to set refresh, formatting, and layout options for the imported data.

    3. Click OK.

      Excel puts the external data range in the location that you specify.

If Excel does not convert a column of data to the format that you want, you can convert the data after you import it. For more information, see Convert numbers stored as text to numbers and Convert dates stored as text to dates.

Export data to a text file by saving it

You can convert an Excel worksheet to a text file by using the Save As command.

  1. Go to File > Save As.

  2. The Save As dialog box appears.

  3. In the Save as type box, choose the text file format for the worksheet.

    • For example, click Text (Tab delimited) or CSV (Comma delimited).

    • Note: The different formats support different feature sets. For more information about the feature sets that are supported by the different text file formats, see File formats that are supported in Excel.

  4. Browse to the location where you want to save the new text file, and then click Save.

  5. A dialog box appears, reminding you that only the current worksheet will be saved to the new file. If you are certain that the current worksheet is the one that you want to save as a text file, click OK. You can save other worksheets as separate text files by repeating this procedure for each worksheet.

  6. A second dialog box appears, reminding you that your worksheet may contain features that are not supported by text file formats. If you are interested only in saving the worksheet data into the new text file, click Yes. If you are unsure and would like to know more about which Excel features are not supported by text file formats, click Help for more information.

For more information about saving files in other formats, see Save a workbook in another file format.

The way you change the delimiter when importing is different depending on how you import the text.

  • If you use Get & Transform Data > From Text/CSV, after you choose the text file and click Import, choose a character to use from the list under Delimiter. You can see the effect of your new choice immediately in the data preview, so you can be sure you make the choice you want before you proceed.

  • If you use the Text Import Wizard to import a text file, you can change the delimiter that is used for the import operation in Step 2 of the Text Import Wizard. In this step, you can also change the way that consecutive delimiters, such as consecutive quotation marks, are handled.

    See Text Import Wizard for more information about delimiters and advanced options.

If you want to use a semi-colon as the default list separator when you Save As .csv, but need to limit the change to Excel, consider changing the default decimal separator to a comma — this forces Excel to use a semi-colon for the list separator. Obviously, this will also change the way decimal numbers are displayed, so also consider changing the Thousands separator to limit any confusion.

  1. Clear Excel Options > Advanced > Editing options > Use system separators.

  2. Set Decimal separator to , (a comma).

  3. Set Thousands separator to . (a period).

When you save a workbook as a .csv file, the default list separator (delimiter) is a comma. You can change this to another separator character using Windows Region settings. 

Caution: Changing the Windows setting will cause a global change on your computer, affecting all applications. To only change the delimiter for Excel, see Change the default list separator for saving files as text (.csv) in Excel.

  1. In Microsoft Windows 10, right-click the Start button, and then click Settings.

  2. Click Time & Language, and then click Region in the left panel.

  3. In the main panel, under Regional settings, click Additional date, time, and regional settings.

  4. Under Region, click Change date, time, or number formats.

  5. In the Region dialog, on the Format tab, click Additional settings.

  6. In the Customize Format dialog, on the Numbers tab, type a character to use as the new separator in the List separator box.

  7. Click OK twice.

  1. In Microsoft Windows, click the Start button, and then click Control Panel.

  2. Under Clock, Language, and Region, click Change date, time, or number formats.

  3. In the Region dialog, on the Format tab, click Additional settings.

  4. In the Customize Format dialog, on the Numbers tab, type a character to use as the new separator in the List separator box.

  5. Click OK twice.

Note:  After you change the list separator character for your computer, all programs use the new character as a list separator. You can change the character back to the default character by following the same procedure.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

See Also

Import data from external data sources (Power Query)

Need more help?

See all How-To Articles

This tutorial demonstrates how to open a text file in Excel and Google Sheets.

converttxt intro

Open Text File in Excel

  1. 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.

Convert Step1

  1. 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.
  2. Click Next.

Convert Step2

  1. 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.
  2. Click Next.

Convert Step3

  1. 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.
  2. Click Finish to import the data into Excel.

Convert Text File

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.

  1. In the Ribbon, select Data > Get and Transform Data > From Text/CSV.

Convert GetData Ribbon

  1. Select the file to be imported, and then click Import.
  2. 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.

Convert LoadData

The data now appears in a new sheet in Excel. There are now two new tabs on the RibbonTable 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.

Convert GetData LinkedData

  1. To unlink the imported data from the external TXT file, in the Ribbon, select Table Design > External Table Data > Unlink.

Convert GetData Unlink

  1. 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.

Convert GetData ConvertToRange

Both the Table Design and Query tabs on the Ribbon disappear.

Open Text File in Google Sheets

  1. From the File menu in Google Sheets, select Import.

Convert GS ImportMenu

  1. Click Upload, and then click on the blue Select a file from your device button to select the required file.

Convert GS Upload

The name of the file to be imported is displayed under File with the default options available for importing automatically selected.

converttxt importfilename

  1. To change the Import Location, click the drop-down list under Import Location and select the option required.

converttxt importlocation

To change the Separator type, click the drop-down list on the right and select a character to delineate by.

converttxt importdelimiter

  1. Keep Convert text to numbers, dates, and formulas checked and then click Import Data to import the file into a new Google sheet.

converttxt opennow

  1. Click Open now.

converttxt gs final


Text files are a common source for storing and transporting information.

This topic will address access, key functions and ways to import and export this data with VBA.


VBA Open

To perform tasks with a text file in VBA you must first access it. We will do this through instruction Open.

Open requires parameters for:

  • O pathname (directory or folder, and drive)
  • O mode of access (Append, Binary, Input, Output, or Random)
  • A filenumber of access (represented by a unique number per file)
    Open PathName For Mode As #FileNumber.

Each of these parameters will be detailed below.


File’s Path

You can assign the path name in two ways:

    PathName = "C:testdatabase.txt" 'Directly through folders path

    PathName = Application.GetOpenFilename() 'Through a dialog box selecting the file

The first form is used when the path does not change constantly. The second gives freedom, at each execution, to choose a different path.

Both of these forms will result in PathName associated with a String of the file location.


Mode

The mode must be one of the following commands:

Output — Used to write Excel content to the text file

Input — Used to read the file

Append — Used to add content to a file

Binary — Used to read and write data in a byte format

Random — Used to place characters of defined size

The focus of this tutorial will be only on: Input (import) and Output (export).


File Number

Each open file must contain a numbering, a number between 1 and 511 preceded by a hashtag #. Normally the numbering starts at #1 and follows successively #2…

Use the FreeFile statement to get the next available file number. If none is in use, FreeFile() will return 1.


Testing Open Instruction

The following code will access the file you selected with Application.GetOpenFilename()

Sub OpenTeste()

    Dim PathName As String

    PathName = Application.GetOpenFilename()
    'Opens the dialog box to select the file

    'Notice that PathName will be a path String E.g. "C:..."

    Dim FileNumber As Integer

    FileNumber  = FreeFile() 'Assigns the first available file number (E.g.: #1)

    Open PathName For Input As #FileNumber

    Close #FileNumber  'Closes the file (the number in FileNumber can be reused)
End Sub

Despite access, no information was imported or exported. To carry out these actions, we will need the help of the functions Input and Output respectively.


Import Text File

To import content from a text file into Excel we will use an example file called «database.txt» and the function Input:

Database TXT

Sub SimpleImport()

    Dim PathName As String

    PathName = Application.GetOpenFilename()
    'Opens the dialog box to select the file

    'Notice that PathName will be a path String E.g. "C:...database.txt"

    Dim FileNumber As Integer

    Open PathName For Input As #1 'File will be associated with the #1

    FirstCharacter = Input(1, #1) 'Collect 1 character from file # 1
    SecondCharacter = Input(1, #1) 'Collect 1 more character, this being the next one (the 2nd in this case)

    MsgBox FirstCharacter
    MsgBox SecondCharacter

    Close #1 'Close the file (number #1 to be reused)
End Sub

MsgBox A

MsgBox q

To collect all the characters at once we can use the LOF function:

Sub LOFimport()

    Dim PathName As String

    PathName = Application.GetOpenFilename()
    'Opens the dialog box to select the file

    'Notice that PathName will be a path String E.g. "C:...database.txt"

    Dim FileNumber As Integer

    Open PathName For Input As #1 'File will be associated with the #1

    MsgBox LOF(1)  'Total number of characters in file # 1

    Allcharacters = Input(LOF(1), #1) 'Collect all characters from file # 1

    MsgBox Allcharacters

    Close #1 'Close the file (number #1 to be reused)
End Sub

LOF returns the number of bytes of the file opened with Open. Because this is a text file, each byte is one character. Thus, the number of bytes will equal the number of characters.

To import the data into spreadsheet we can use the following code:

Sub TextImport ()
    Dim PathName As String
    Dim FileNumber As Integer
    Dim Textdata As String
    Dim BreakingLine as Variant
    Dim Lastline as Integer
    Dim Firstline as Integer

    'Opens the dialog box to select the file
    PathName = Application.GetOpenFilename()
    'Or enter a path with PathName = "C:FILE_LOCATIONdatabase.txt"

    FileNumber = FreeFile() 'Assigns the first available file number (E.g.: #1)

    Open PathName For Input As #FileNumber 'Open file in read mode

    'Copy the contents to Worksheet ---
    Textdata = Input(LOF(FileNumber), FileNumber) 'Loads all file contents into variable
    BreakingLine = Split(Textdata, vbCrLf) 'Creates a vector with each line of the file 
    Lastline = UBound(BreakingLine) 'Determines the last line of the vector
    Firstline = LBound(BreakingLine) 'Determines the first line of the vector
    'Transpose the vectors into the worksheet
    Range("A1").Resize((Lastline) - (Firstline) + 1).Value = Application.Transpose(BreakingLine)
    '----------------------------------
    Close #FileNumber 'Closes the file (the number in FileNumber can be reused)
End Sub

vbCrLf is a non-visible character CrLf indicates a line break in the file.


Main Functions Related to Open

Function Description
FreeFile Returns the next available number for the Open statement. Important when working with multiple files.
BOF Returns True if it is at the beginning of the defined #filenumber.
EOF Returns True if it has finished reading the defined #filenumber.
LOF Returns the size in bytes of the defined #filenumber.
Loc Returns the current read and write position for the Open.

BOF and EOF assist in building Loops when you want to work character by character, or line by line.

Character per character

    'Collect one by one
    Characters = Input(1, #1) 'Collect 1 character from file # 1
    Characters = Characters & Input(1, #1) 'Collect 1 more character, this being the next
    Characters = Characters & Input(1, #1) 'Collect 1 more character, this being the next
    '...

Loop with EOF support

    'Loop with EOF support
    Characters = ""
    Do While Not EOF(1)
        Characters = Characters & Input(1, #1)
    Loop

Loop with BOF support

    'Loop with BOF support
    Do While BOF(1)
        Characters = Characters & Input(1, #1)
    Loop

Export Text File

To export worksheet content to a text file:

Sub TextExport()

    Dim LastRow As Long
    Dim LastColumn As Long
    Dim NewFile As String
    Dim FileNumber As Integer
    Dim CellData As Variant

    FileNumber = FreeFile ' Assigns the first available file number (E.g.: #1)

    'Determines the last row of the worksheet with data
    LastRow = Cells(Rows.Count, 1).End(xlUp).Row

    'Determines the last column of the worksheet with data
    LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
    NewFile = "C:TestExport.txt" 'Use an existing folder

    'Exports the data from the worksheet to the created file
    Open NewFile For Output As #FileNumber 
    For i = 1 To LastRow
        For j = 1 To LastColumn
            If j = LastColumn Then
                CellData = CellData & Cells(i, j).Value
            Else
                CellData = CellData & Cells(i, j).Value & " "
            End If
        Next j
        Print #FileNumber, CellData
        CellData = ""
    Next i
    Close #FileNumber 'Saves and closes the text file with the data
End Sub

An error will occur if the folder you are saving the file does not already exist.


CSV File

A .csv file (Comma Separated Values) is, as the name suggests, a text file in which the items in each row are separated by commas, delimiting what should go in each column.

CSV Example

It is a very common type of file, and since each line refers several times to multiple columns, it may require a treatment with loops and functions, such as BOF and EOF.


Import CSV File

For ease of import, the Line Input instruction (which works line by line), rather than just Input (which works character by character).

Sub OpenTextToCSV()
    Dim PathName As String
    Dim FileNumber As Integer
    Dim FileRow As String
    Dim RowItem As Variant
    Dim LastRow As Long

    'Opens the dialog box to select the file
    PathName = Application.GetOpenFilename()
    'Or enter a path Ex: PathName = "C:testdatabase.txt"

    FileNumber = FreeFile ' Assigns the first available file number (Ex: #1)

    Open PathName For Input As #FileNumber 'Opens the file in read mode

    Do Until EOF(FileNumber)
        Line Input #FileNumber, FileRow
            RowItem = Split(FileRow, ", ")
            i = i + 1
            LastRow = UBound(RowItem)
            For j = 1 To LastRow + 1
                Cells(i, j).Value = RowItem(j - 1)
            Next
    Loop

    Close #FileNumber
End Sub

Export CSV File

Similar to exporting text, however mandatory the use of «, « in the separation of elements.

Sub SaveTextToCSV()

    Dim LastRow As Long
    Dim LastColumn As Long
    Dim NewFile As String
    Dim FileNumber As Integer
    Dim CellData As Variant

    FileNumber = FreeFile ' Assigns the first available file number (Ex: #1)

    'Determines the last row of the worksheet with data
    LastRow = Cells(Rows.Count, 1).End(xlUp).Row

    'Determines the last column of the worksheet with data
    LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
    NewFile = "C:TestExport.csv" 'Use an existing folder

    'Exports the data from the worksheet to the created file
    Open NewFile For Output As #FileNumber
        For i = 1 To LastRow
            For j = 1 To LastColumn
                If j = LastColumn Then
                    CellData = CellData & Cells(i, j).Value
                Else
                    CellData = CellData & Cells(i, j).Value & ", "
                End If
            Next j
            Print #FileNumber, CellData
            CellData = ""
        Next i
    Close #FileNumber 'Saves and closes the text file with the data
End Sub

An error will occur if the folder you are saving the file does not already exist.



SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.

Excel ® is a registered trademark of the Microsoft Corporation.

© 2023 SuperExcelVBA | ABOUT

Protected by Copyscape

Different applications generate data in different forms.

A SaaS application might generate a report in the form of a PDF, while another application might generate data in the form of a TXT or CSV file.

The challenge lies in consolidating the data into a single application that can work with all the data to produce the required results.

Microsoft Excel is one application that is frequently used for this, owing to its versatility in importing data from files with a wide variety of extensions.  

For example, if you have a list of items saved in a Text file (or in Notepad), Excel allows you to import this list so that you can process it further.

In this tutorial we will show you two ways to convert a text file to Excel:

  • By using the Text Import Wizard
  • By opening the file directly in Excel

What is a Text File?

A Text file is one that contains text with no special formatting (as in bold, italic, images, etc.).

These files are identified with the ‘.txt’ extension and can be opened in any text editor, like Notepad or word processor, like Microsoft Word.

But in many cases, you can have data in a text file that you need to open in Excel and analyze there.

Thankfully, you can easily open text files in Microsoft Excel and then further work on it.

Let’s see how to do that!

Let us look at two ways in which we can convert a Text file (.txt) to Excel.

Method 1: Using the Text Import Wizard to Convert a Text File to Excel

If you have a spreadsheet open in Excel and want to import the contents of a Text file at a specific area of your spreadsheet, the Text Import Wizard might be the best way to go.

This wizard scans your text file and ensures that the data in the file is imported the way you want.

To use the Text Import Wizard, select the Data tab, followed by ‘From Text’ (which you will find under the ‘Get External Data’ group. 

Click on the From Text option

After this, select the text file that you want to import.

Select the text file that you want to open

Your Text Import Wizard should now open automatically. 

Text Import Wizard

The Text Import Wizard guides you in providing the best settings to import your text file data through 3 steps:

Step 1 of 3

In this step you can provide the settings for the following:

  • Original Data Type: Here you can choose how you want your data to be separated into columns. You have two options:
    • Delimited: Select this if your text file data is separated by tabs, colons, semicolons or other characters.
    • Fixed width: Select this if all items in each column of your data are the same width.
  • Start import at row: Type or select the first row of your data from where you want to start importing.
  • File origin: Select the character set that your text file uses, for example 437 (for the OEM United States character set). Usually, it’s fine to leave this at the default setting.
  • My data has headers: Keep this field checked if your Text file’s dataset contains headers.
Step 1 settings for text import wizard

Step 2 of 3

If you had selected the ‘Delimited’ radio button in Step 1, then this step lets you specify the delimiters that your data contains (for example tabs, commas, semicolons, etc.) You can also specify if you want consecutive delimiters to be counted as one. 

Moreover, if your text values are enclosed in a special set of characters (for example in single or double quotes), then you can specify the character in this step.

These characters are known as ‘Text qualifiers’ and help specify if you want a set of values to be imported as one.

For example, “Scott, Steve” is imported as a single value, even though the words are separated by a comma delimiter.

Step 2 settings for text import wizard

At the bottom of the screen, you can see a preview of how your data will get affected in the spreadsheet after conversion.

If you had selected the ‘Fixed Width’ radio button in Step 1, on the other hand, then Step 2 lets you specify widths for each column.

You can introduce a new column break in the preview window by simply clicking at the appropriate point on the scale.

A line with an arrow should appear to represent the column break.

Line represents the line break

Place line breaks wherever you need to in the preview window.

If you want to move a line break, simply drag it across. If you want to remove a line, simply double-click on it.

Step 3 of 3

This lets you specify the data format for each column.

You can specify if you want a column to remain in the default format set by the Text Import Wizard or if you want to set the format to be General, Text, or Date

Step 3 settings for text import wizard

Simply select a column from the preview window and select the format you want.

If you want to remove a selected column, select the last radio button option (which says ‘Do not import column‘).

The Advanced button in this step opens the Advanced Text Import Settings dialog box. 

Advanced Text Import Settings dialog box

This dialog box lets you specify advanced formatting options.

For example, you can use the Advanced Text Import Settings to specify what decimal or thousands separators have been used in the text file, so that they can be made to match your computer’s regional settings.

Once you’re done providing all the settings for your imported text data, click on the Finish button.

Finish importing text file into Excel

This will open the Import Data dialog box.

Import Data dialog box

In this box, you can select where you want your text file’s data imported.

If you want to import it into the existing worksheet, you can select or type in a reference to the cell where you want Excel to start displaying the imported data.

If you want to open it in a new worksheet, however, then select the radio button next to ‘New Worksheet’.

Click OK.

Your text file should now get imported to your selected location in Excel, with the format settings that you had specified in the Text Import Wizard.

Imported data opened in Excel
Also read: How to Open XML Files in Excel?

Method 2: Opening a Text File Directly in Excel

You can also choose to simply open the text file directly in Excel.

While opening, Excel recognizes a text file and automatically converts it into a format that can be displayed in a spreadsheet. 

All you need to do is click on the File tab, select Open and then browse and select the text file that you want to open.

One issue that you are likely to face when trying to open a text file directly in Excel is trying to locate the file in the folder.

This is because Excel’s ‘Open File’ dialog box, by default, filters, and displays only Excel files like those with extensions ‘.xls’, ‘.xlsx’, etc.

It also displays CSV files, if your computer is set up to use Excel as the default application to open CSV files.

So if you don’t see your required text file in the folder when trying to open it in Excel, simply select ‘All Files’ from the ‘File Types’ drop-down, as shown below:

Select the file type from the drop down

This will display the Text Import Wizard from where you can set up how you want your Text file’s data to be displayed in Excel (as shown in method 1).

Text Import Wizard

You should now see your text file converted and displayed in Excel.  

Final data in Excel

Once the file opens, if you still find some of the columns (or individual cells) not converted to your required format, you can convert them manually.

While this method to open the Text file directly in Excel works well, the benefit of using the first method (using Text Import Wizard) allows you to make some adjustments even before getting the data in Excel.

In this tutorial, we showed you two ways to convert and open a Text file in Excel.

A third method could be by using online tools like Online2pdf, but we did not dwell too much on this because Excel’s Text Import Wizard provides much more flexibility, allowing you to adjust your data, and format them exactly how you want them.

We hope this tutorial was helpful for you.

Other Excel tutorials you may also like:

  • How to Convert a CSV File to Excel?
  • How to Open VCF File in Excel?
  • How to Open Excel File [xls, xlsx] Online (for FREE)
  • Why does Excel Open on Startup (and How to Stop it)
  • How to Make Excel File Read Only
  • How to Insert an Excel file into MS Word
  • How to Save Selection in Excel as PDF (3 Easy Methods)
  • How to Merge Two Excel Files?
  • How to Convert PDF to Excel without Software?
  • How to Open DAT Files in Excel?

You may need to access a text file in Excel for a variety of reasons when working on various projects. Data generation can be carried out in a variety of methods, just like the design of every application for a certain purpose. Word provides the ability to make documents with the look and feel of a PDF. Text files can be created in a variety of ways, but because of the data they contain, they must be opened in Excel.A slow project is the result if you don’t know how to open text file in Excel.

This article explains how to open text file in Excel using three distinct approaches, so that you may continue your work. A few minutes of your time here and you’ll be able to open text file in Excel and get to work!

How To Open Text File in Excel: First Method

1. Click inside of the cell of WPS spreadsheet where you want to embed the file.

2. Now go to the insert and click on object which will be on the right side of WPS spreadsheet.

3. After clicking the object you will shown up insert object window select the create from file option and then browse the file you want to embed to WPS spreadsheet.

4. Once you browse the file you want to embed, click on display as icon option and hit ok and your file will be embedded to WPS worksheet.

How To Open Text File in Excel: Second Method

1. Open the Excel spreadsheet where you want to save the data and click the Data tab. And go to the import data option which is circled in following picture.

2. Once you open the import data option you will find the options choose import data again.

3. Click ok in the pop-up window.

4. Now select data source it means the from which text file you want to get the data which you want to convert to excel which is show by number 1 in following picture. And then click the next option and choose the file from your computer you want to convert.

5. Once you click the next the file conversion window will be open stay with other encodings and click next.

6. Now you have text import wizard-step 1 of 3 window stay with “delimited” and click the next.

7. Now you have text import wizard-step 2 of 3 window stay with tab and then click next.

8. Now stay with the General option and click finish.

9. Once you will click the finish your data will be imported to the excel.

How To Open Text File in Excel: third Method

1. Copy the text you want to convert to columns.

2. Paste the text to your worksheet, and select the cells you want to convert.

3.  Once you select the cell you want to convert Click Data tab choose Text to Columns. It will pop up a Convert Text to Columns Wizard Dialog Box.

4. Choose the file type that best describes your data and click Next.

• The Delimited option means that characters in your text, such as commas or tabs, divide each field.

• The Fixed Width option aligns fields in columns with space between each field.

5. Define the data delimiters, such as tab, semicolon, comma, space, and others.

6. Select the Date Format in Column data format, and a data preview will appear in the dialogue box.

Finally, your material will appear in numerous columns. Tab and space are used as delimiters in this example. Other delimiters are possible. By checking several check boxes, you can see how your data will be divided.

This article outlines the procedures necessary that how to open text file in Excel spreadsheet. Please visit the WPS Academy website for further information on the WPS office. You may also get a free download of WPS Office from this site, which allows you to edit documents in Word, Excel, PowerPoint, and PDF.

Like this post? Please share to your friends:
  • What is a text box in excel
  • What is a tangible word
  • What is a tag name in word
  • What is a synonym of the word influence
  • What is a synonym for the word usually