How to Convert Notepad to Excel with Columns (5 Methods)

Sometimes your dataset might be stored in text (.txt) format. In Windows, text files are usually accessed using Notepad, a dedicated text editor application owned by Microsoft. Let’s explore how to convert from Notepad to Excel with columns.

To demonstrate, we’ll use a Sales Report text file, which contains some Product Items along with Product ID, States, and Sales.

Dataset

Note: The above text is tab-delimited, which means that the tab is acting as the separator.

 

Method 1 – Opening Notepad Directly 

Step 1 – Open Notepad

➤ Create a blank workbook and click File > Open.

Opening Notepad Directly

➤ Navigate to the file location where the text file is located.

➤ Click on the text file. If you don’t see the file, make sure that Text Files is selected as the Format.

➤ Click Open.

Opening Notepad Directly

Step 2 – Using the Text Import Wizard

A dialog box namely Text Import Wizard opens.

➤ Check the Delimited option.

➤ Check My data has headers.

➤ Click Next.

Opening Notepad Directly

➤ Select Tab under Delimiters.

➤ Click Next.

Opening Notepad Directly

➤ Select General as Column data format.

➤ Click Finish.

Opening Notepad Directly

The text file is imported into Excel, with the data accurately transcribed into Columns.

How to Convert Notepad to Excel with Columns Opening Notepad Directly

After changing the formatting as desired, the output is as follows:

How to Convert Notepad to Excel with Columns Opening Notepad Directly

Read More: How to Convert Text File to Excel Automatically


Method 2 – Copy and Paste Text from Notepad

The downside of Method 1 is the inability to change the location in the worksheet where the imported data will be placed.

This Method allows the location of the imported data to be specified, for example, starting from cell B4.

STEPS:

➤ Open the text file in Notepad.

➤ Select the text to be imported and press CTRL + C to copy.

How to Convert Notepad to Excel with Columns Copy and Paste Text inside Notepad

➤ In the Excel worksheet, click cell B4 and press CTRL + V to paste.

Copy and Paste Text

The output is as follows:

Copy and Paste Text


Method 3 – Import Comma Delimited Text from Notepad 

One of the drawbacks of the Method 2 is that it doesn’t split into columns if the text uses a comma delimiter. Here’s how to import comma delimited text:

Step 1 – Copy and Paste the Texts

➤ Open the text file in Notepad.

➤ Select and copy the text to be imported.

How to Convert Notepad to Excel with Columns When the Text is Comma Delimited

➤ Paste the copied text into cell B4 as in Method 2.

➤ The text is imported but without separation into columns.

Step 2 – Use Text to Columns Feature

➤ Click Data >  Data Tools > Text to Columns. A dialog box opens.

How to Convert Notepad to Excel with Columns When the Text is Comma Delimited

➤ Select the Delimited data type.

➤ Click Next.

When the Text is Comma Delimited

➤ Select Comma under Delimiters.

➤ Click Next.

How to Convert Notepad to Excel with Columns When the Text is Comma Delimited

➤ Keep the General data format checked.

➤ Click Finish.

When the Text is Comma Delimited

The imported text is split into Columns.

How to Convert Notepad to Excel with Columns When the Text is Comma Delimited


Method 4 – Using Power Query

Power Query (a data transformation and preparation engine in Excel) is another way of easily importing text data into Excel.

STEPS:

➤ Click the Data tab > Get Data > From File > From Text/CSV.

How to Convert Notepad to Excel with Columns Using Power Query

➤ Click the text file.

➤ Click the Import button.

How to Convert Notepad to Excel with Columns Using Power Query

➤ A preview of the output appears, where the Tab is selected as the Delimiter by default.

➤ Select the Load to option to specify a specific import location.

Using Power Query

➤ Specify the location (e.g. =PowerQuery!$B$4).

➤ Click OK.

Using Power Query

The text is imported separated into Columns.

How to Convert Notepad to Excel with Columns Using Power Query


Method 5 – Using VBA Code

STEPS:

➤ Open a VBA module by clicking Developer > Visual Basic (or pressing ALT + F11).

How to Insert VBA Code

➤ Go to Insert > Module.

How to Insert VBA Code

➤ Copy the following code into the newly created module:

Sub ConvertNotepadToExcel()
Dim Txt As String
Open "E:\Exceldemy\Sales Report.txt" For Input As 60
Range("B4").Select
Do Until EOF(60)
Input #60, Txt
ActiveCell.Value = Txt
ActiveCell.Offset(1, 0).Select
Loop
Close (60)
End Sub

Using VBA Code How to Convert Notepad to Excel with Columns

Two things that you have to change:

  • Specify the path: Specify the path (file location) of the existing text file eg E:\Exceldemy\Sales Report.txt.
  • Select the output cell: Specify the location where the converted data will be placed, eg cell B4.

After running the code (press F5), the following output is returned:

How to Convert Notepad to Excel with Columns Using VBA Code

After using the Text to Columns feature detailed in step 2 of  Method 3 and formatting, the above output will display as follows:

Using VBA Code

Read More: VBA Code to Convert Text File to Excel


Download Practice Workbook


Related Articles

<< Go Back to Import Text File to Excel | Importing Data in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Abdul Kader
Md. Abdul Kader

MD. ABDUL KADER is an engineer with a talent for Excel and a passion for VBA programming. To him, programming is like a time-saving wizard, making data manipulation, file handling, and internet interactions a breeze. His skill set extends to SWM, GIS, RS, and SPSS. He holds a B.Sc in Urban & Regional Planning from Chittagong University of Engineering and Technology and has shifted to become a content developer. In this role, he crafts technical content centred around... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo