How to Import Data in Excel (from Text, CSV, Database, Web etc.) – 10 Methods

Feature Image for Importing Data in Excel

The image above showcases a CSV (Comma Separated Values) file which was imported to an Excel worksheet.

 


Method 1 – Importing Data to Excel by Using Copy and Paste Feature

You want to import the Spanish LaLiga Standings 2023-2024.

Table to be Copied

 

  • Open the website and select the data.> Presss Ctrl + C to copy.> Select A1 in the Excel Worksheet> Paste the Data.

This is the output.

Data in Excel

  • To format data as a table, select the data range (A1:G21) and press Ctrl+ T.
  • In the Create Table dialog box, check the My table has header.> Click OK.

 Create table

This is the output.

Table for Copy and Paste


Method 2 – Importing Data from the Notepad to Excel

 

i) Importing a Text File to Excel

You have a text file (“Text File(Semicolon)” ) in Notepad.

Input Text

Note: The semicolon is used as a delimiter,  marking the boundaries between different pieces of information. Common delimiters include commas (,), tabs (\t), spaces, semicolons (;), or colons (:).
  • Open Excel.
  • Click Open> Browse.

 Clicking on Browse

  • Locate the file, select it and click Open.

Select the Desired Text File in the Open Dialogue Box

  • In the Text Import Wizard, select Delimited >and check “my data has headers”> Click Next.

Selecting Delimited in the Wizard

  • Check Semicolon> Click Next.

Selecting the Delimiter and On Next

  • Select Column data format as General > Click Finish.

 Clicking on Format and Finish the Process

Imported data will be displayed.

 Imported Data (Without Formatting)

  • Format the dataset.This is the output.

Imported Data with Format

Note: When you import text files by opening them in Excel, data will be imported into the different workbooks.

Download Text File (Input)

Download the file to practice.


ii) Importing Data by Connecting to the Power Query

  • Click Data> Get Data> From File> From Text/CSV.

Clicking on From Text-CSV in the Data Ribbon

  • In the Import Data dialog box, select the text file and click Import.

Selecting the Text File Separated by Semi-Colon

  • Select Semicolon as Delimiter and click Transform Data.

 Clicking on Transform Data

  • The Power Query Editor will be displayed. Click Close and Load.

 Click on Close and Load in the Power Query Editor

Data will be imported as a table in a worksheet.

Imported Data by Connecting Power Query


iii) Importing Data by Using the Text Import Wizard in Excel

  • Click File> Options.

Enable Legacy Wizard

  • In the Excel Options dialog box, click Data > Check From Text (Legacy) in Show legacy data imports wizards> OK. This will enable the wizard.

Enable Wizard

  • Import the text file (semicolon is used as delimiter) as shown below into your Excel workbook using the Text Import Wizard.

 Input Text

 

  • Click Data> Get Data> From Legacy Wizards> From Text (Legacy).

. Clicking on Legacy Wizard

  • In the Import Text File dialog box, select the text file> Click Import.

Select and Import the File in the Wizard

  • In the Text Import Wizard dialog box, select Delimited> Check “My data has headers”> Next.

Clicking on Next in the Wizard

  • Check Semicolon> Click Next.

Selecting Semi-colon as Delimiter

  • Select Column data format as General > Click Finish.

 Formatting the Data Type in the Wizard

  • In the Import Data dialog box, select Existing Worksheet and A1> click OK.

Selecting the Worksheet and Range

This is the output.

Imported Data Using Import Data Wizard

  • Select A1:E10 and click Insert> Table. This is the output.

 Convert into Table


Method 3 – Importing Data from a File in Excel

i) Importing Data from Another Workbook

 Data in Another workbook

  • Click Data> From File> From Excel Workbook.

Clicking on from Another Workbook

  • In the Import Data dialog box, select the workbook> Click Import.

Select the File and Import

  • Select Table1 (you can check the preview to ensure you are importing the right data)> Click Load.

Select the Table in the Workbook and Load

This is the output.

 Imported Table from Another Workbook


Download Input Workbook

You can use this workbook to practice.


ii) Importing Data from a CSV File in Excel

You have a CSV file.

 Input Text File

  • Click Data> From File> From Text/CSV.
  • In the Import Data dialog box, select the CSV file> Click Import.

Select the File and Click on Import

  • Click Load.

Click on Load

This is the output.

 Imported CSV File in Excel

Note: If you save your text file as CSV, you can easily import data by opening the file.

Download CSV (Input)


iii) Importing Data from PDF to Excel

Your PDF file should be organized like a table.

Input PDF

  • Click Data> From File> From PDF.
  • In the Import Data dialog box, select the PDF file> Click Import.

Select the PDF File and Click on Import

  • Click Load.

Select the Table and Click on Load

This is the output.

 Imported Table from PDF File

You can also import an XML file or a folder to your Excel Worksheet.


Download PDF (Input)

Read More: How to Import PDF to Excel


Method 4 – Importing Data from a Database to Excel

You have imported data from a database: “From Database”

From Database

 

  • Click Data> From Database> From Microsoft Access Database.

Clicking on From Database

  • Select the database file in the Import Data dialog box> Click Import.

Selecting the Database File

  • In the Navigator dialog box, select the data> Click Load.

 Selecting the Data in the Database from the Dialogue Box

  • This is the output.

 Database Imported as Table


Method 5 – Importing Data from Google Forms to Excel

  • Go to Google Forms> Click View in Sheets.

Click on View in Sheets

  • Click File> Download> Comma Separated Values(CSV). Save the CSV file.

Download it as CSV Files

  • Click Data> From File> From Text/CSV> Select the file in the Import Data dialog box> Click Import.

CSV File Download

  • Click Load in the Dialog box.
  • This is the output.

Imported Data from Google Forms


Download CSV from Google Form (Input)


Method 6 – Importing Data from Other Sources in Excel

i) Importing Data from a Table

Input Table

 

  • Go to the worksheet that contains the table you want to import. Select the whole table.
  • Click Data > Get Data > From Other Sources> From Table/Range.

 Clicking on From Table or Range

  • The table will be displayed on the Power Editor. Click Close and Load.

Click on Load&Close in the Power Query Editor

This is the output.

 Imported Data from Table


ii) Importing Data from the Web

 Input From Web

Go to the Web page and copy the link.

  • Click Data> From Other Sources> From Web.
  • In the From Web dialog box, paste the link in the URL box> Click OK.

 Pasting the Web Link in the Dialogue Box

  • In the Navigator dialog box, select the table> Click Load.

Selecting the Table in the Dialogue Box

This is the output.

 Imported Data Table From Web


iii) Importing Data from a Picture to Excel

Data Picture

  • Click Data > From Other Sources> From Picture> Picture from File.

 Clicking on Importing from Picture

  • In the Insert picture dialog box, select the file> Click Insert.

Selecting the Image to Import Data

  • The Data from Picture box will be displayed. Click Insert Data> Insert Anyway.

 Clicking on Insert Data

This will import the data as shown below:  Values are not correctly placed and an empty column B is added. Data must be manually placed in the correct cells.

Data from Picture

This is the output.

 Formatted Data from Picture

 

Read More: How to Extract Data from Image into Excel


Method 7 – Importing Data from Existing Data Connections and Maintain Automatic Updates in Excel

  • Click Data > Get Data Using an Existing Connection

Clicking on the Icon

  • In the Existing connection dialogue box, click Tables > select the existing table (Text_File_Semicolon). > Click OK.

 Selecting the Table From Existing Connection

  • In the Import Data dialog box, click Table> Existing Worksheet.

Selecting the Worksheet

This is the output.

 Imported Data from Existing Connection

  • To update data automatically, click Data > Refresh All.

Update The Data Connection


Method 8 – Importing HTML to Excel

 HTML Input

This dataset is the output of your HTML file.  To import it:

  • Click Data> From File> From Text/CSV.
  • In the Import Data dialog box, Click  All Files > select the HTML file > Click Import.

 Selecting the HTML file

  • In the navigator box, select the table. > Click Load.
Note: Check the preview before clicking Load.

 Click on Load

This is the output.

 Imported Data as Table from HTML


Method 9 – Using the Text to Columns Feature to Import WhatsApp Group Contacts to Excel

 Group WhatsApp

There are 311 participants. To import the contacts:

  • Go to the web.whatsapp.com website.
  • You will see the one-time generated QR code.
  • Scan it on your smartphone to connect it to your WhatsApp account.

Scan QR Code to Connect WhatsApp

  • You can access the WhatsApp account on the computer.
  • Select your WhatsApp group> Right-click “Programming” WhatsApp group.>Click Inspect

Click on Inspect

  • A window with the back-end codes of your WhatsApp group contacts will be displayed.
  • Go to the Elements > Choose Copy> Click Copy element.

Copy from the Elements

  • Paste the back-end codes in your Excel sheet.
  • Select the entire code from the Excel sheet.> Go to Data > Click Text to Columns command.

 Convert the Text into Column

  • Select Delimited > Click Next.

 Clicking on Delimited

  • Select Comma as delimiter> Click Next.

Select Comma in the Wizard

  • Select General in Column data format > Click Finish. 

Set the Data Type as General

  • Select the entire row.> Click Copy
  • Right-click the Excel sheet. > Go to Paste Special > Select Transpose and click it.

Tips: You can select an entire row by pressing Ctrl+ Shift+ (→).

 Use Paste Special

This is the output.

Imported Data From Whatsapp


Method 10 – Importing Data in Excel by Using VBA Macros

 

 Input VBA to Import Data

B1:F14 contains the data you want to import.

  • Go to the Developer tab> Visual Basic.

Clicking on Visual Basic

In the VBA Editor, click Insert> Module. Enter the following code and save the file.

Sub Import_Data_Using_VBA()
Dim Location_of_File As String
Location_of_File = Application.GetOpenFilename
If Location_of_File = "False" Then
Beep
Exit Sub
End If
Application.ScreenUpdating = False
Set Import_Data = Workbooks.Open(Filename:=Location_of_File)
Import_Data.Worksheets(1).Range("B1:F14").Copy
Sheet16.Range("B4").PasteSpecial xlPasteValues
Import_Data.Close
Application.ScreenUpdating = True
End Sub

Insert Mode and Code

  • Press F5 to run the code.
  • In Open, select the workbook> Click Open.

Select the File after clicking F5

This is the output.

 Imported Data By VBA Macros


Download Workbook (Input)


Importing and Creating a Data Model Relationship in Excel

You have two datasets in two different worksheets.

Input Table

The second is in another worksheet that contains the ID of the employees, sales product, and amount by the employees.

Product Details

Import the second data table:

  • Select the second data table (A1:C8).> Right-click > Click Copy.

Copy the Table

  • Place the cursor on E5.> Paste the table.

This will import the table, placing it beside the first table.

Copy the Table

Both tables contain one column in common: ID. To create a relation between them, use the Table Relationship feature.

  • Select the table> go to the Table Design tab> double-click the Table Name
  • Assign a name (Info_Table) to the new table.

 Naming the Table

  • Repeat the steps for the second dataset. Rename the second table (Product)

 Name the other Table

  • Select a cell in the first table (Info_Table)> go to the Data tab> select Relationships in the Data Tools group.

 Selecting the Relationship

Clicking on New

  • In the Create Relationship command box, choose

In Table: The first created table (Info_Table)
In Column (Foreign): Common column between the tables (ID)
In Related table: The new table (Product)
In Related Column (Primary): The Common column between the tables (ID)

  • Click OK.

Selecting the Foreign Key

  • Go to the Insert tab> click Pivot Table> select From External Data Source.

 Clicking on from External Source

  • In the PivotTable from an external source window, click Choose Connection…

 Create the Connection

  • In Existing Connections, in the Tables group, select Tables. In Workbook Data Model > click Open.

 Choose the Table

  • Click OK to close the PivotTable from an external data source

Select the Worksheet

  • In Pivot Table Fields, the two tables will be shown: the Info table has two columns: ID, and Employee; and the Product table has 3 columns: ID, Product, and Sales. You want to create relationships by connecting Employee in the Info_Table and Sales in the Product table.
  • Drag Employee from the Info group to the Rows field, and enter Sales in the Values field.

Selecting Employee

  • Click Auto-Detect to create Relationships.

 Click on Auto Detect

This is the output.

Table showing Relationship

Note: While creating relationships between tables, tables must have at least one common Column.

 


Download Workbook (All Methods)

 

Importing Data in Excel: Knowledge Hub

<< Go Back to Learn Excel

Get FREE Advanced Excel Exercises with Solutions!

Tags:

Zahid Shuvo
Zahid Shuvo

Zahid Hasan Shuvo, a Naval Architecture and Marine Engineering graduate from BUET, Bangladesh, has contributed nearly a year to the Exceldemy Project as an Excel and VBA Content Developer. Within this timeframe, he has crafted over 8 tutorial articles, and besides offering valuable solutions to aid users effectively. Zahid also expresses keen interests in Excel & VBA, Data Analysis, Machine Learning, AI Engines, and Prompt Engineering, showcasing a diverse skill set and contributing to the dynamic environment of... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo