Downloading data into excel

Abstract:    This is the first tutorial in a series designed to get you acquainted and comfortable using Excel and its built-in data mash-up and analysis features. These tutorials build and refine an Excel workbook from scratch, build a data model, then create amazing interactive reports using Power View. The tutorials are designed to demonstrate Microsoft Business Intelligence features and capabilities in Excel, PivotTables, Power Pivot, and Power View.

Note: This article describes data models in Excel 2013. However, the same data modeling and Power Pivot features introduced in Excel 2013 also apply to Excel 2016.

In these tutorials you learn how to import and explore data in Excel, build and refine a data model using Power Pivot, and create interactive reports with Power View that you can publish, protect, and share.

The tutorials in this series are the following:

  1. Import Data into Excel 2013, and Create a Data Model

  2. Extend Data Model relationships using Excel, Power Pivot, and DAX

  3. Create Map-based Power View Reports

  4. Incorporate Internet Data, and Set Power View Report Defaults

  5. Power Pivot Help

  6. Create Amazing Power View Reports — Part 2

In this tutorial, you start with a blank Excel workbook.

The sections in this tutorial are the following:

  • Import data from a database

  • Import data from a spreadsheet

  • Import data using copy and paste

  • Create a relationship between imported data

  • Checkpoint and Quiz

At the end of this tutorial is a quiz you can take to test your learning.

This tutorial series uses data describing Olympic Medals, hosting countries, and various Olympic sporting events. We suggest you go through each tutorial in order. Also, tutorials use Excel 2013 with Power Pivot enabled. For more information on Excel 2013, click here. For guidance on enabling Power Pivot, click here.

Import data from a database

We start this tutorial with a blank workbook. The goal in this section is to connect to an external data source, and import that data into Excel for further analysis.

Let’s start by downloading some data from the Internet. The data describes Olympic Medals, and is a Microsoft Access database.

  1. Click the following links to download files we use during this tutorial series. Download each of the four files to a location that’s easily accessible, such as Downloads or My Documents, or to a new folder you create:
    > OlympicMedals.accdb Access database
    > OlympicSports.xlsx Excel workbook
    > Population.xlsx Excel workbook
    > DiscImage_table.xlsx Excel workbook

  2. In Excel 2013, open a blank workbook.

  3. Click DATA > Get External Data > From Access. The ribbon adjusts dynamically based on the width of your workbook, so the commands on your ribbon may look slightly different from the following screens. The first screen shows the ribbon when a workbook is wide, the second image shows a workbook that has been resized to take up only a portion of the screen.

    Import data from Access

    Import data from Access with small ribbon

  4. Select the OlympicMedals.accdb file you downloaded and click Open. The following Select Table window appears, displaying the tables found in the database. Tables in a database are similar to worksheets or tables in Excel. Check the Enable selection of multiple tables box, and select all the tables. Then click OK.

    Select table window

  5. The Import Data window appears.

    Note: Notice the checkbox at the bottom of the window that allows you to Add this data to the Data Model, shown in the following screen. A Data Model is created automatically when you import or work with two or more tables simultaneously. A Data Model integrates the tables, enabling extensive analysis using PivotTables, Power Pivot, and Power View. When you import tables from a database, the existing database relationships between those tables is used to create the Data Model in Excel. The Data Model is transparent in Excel, but you can view and modify it directly using the Power Pivot add-in. The Data Model is discussed in more detail later in this tutorial.

    Select the PivotTable Report option, which imports the tables into Excel and prepares a PivotTable for analyzing the imported tables, and click OK.

    Import Data window

  6. Once the data is imported, a PivotTable is created using the imported tables.

    Blank Pivot Table

With the data imported into Excel, and the Data Model automatically created, you’re ready to explore the data.

Explore data using a PivotTable

Exploring imported data is easy using a PivotTable. In a PivotTable, you drag fields (similar to columns in Excel) from tables (like the tables you just imported from the Access database) into different areas of the PivotTable to adjust how it presents your data. A PivotTable has four areas: FILTERS, COLUMNS, ROWS, and VALUES.

The four PivotTable Fields areas

It might take some experimenting to determine which area a field should be dragged to. You can drag as many or few fields from your tables as you like, until the PivotTable presents your data how you want to see it. Feel free to explore by dragging fields into different areas of the PivotTable; the underlying data is not affected when you arrange fields in a PivotTable.

Let’s explore the Olympic Medals data in the PivotTable, starting with Olympic medalists organized by discipline, medal type, and the athlete’s country or region.

  1. In PivotTable Fields, expand the Medals table by clicking the arrow beside it. Find the NOC_CountryRegion field in the expanded Medals table, and drag it to the COLUMNS area. NOC stands for National Olympic Committees, which is the organizational unit for a country or region.

  2. Next, from the Disciplines table, drag Discipline to the ROWS area.

  3. Let’s filter Disciplines to display only five sports: Archery, Diving, Fencing, Figure Skating, and Speed Skating. You can do this from within the PivotTable Fields area, or from the Row Labels filter in the PivotTable itself.

    1. Click anywhere in the PivotTable to ensure the Excel PivotTable is selected. In the PivotTable Fields list, where the Disciplines table is expanded, hover over its Discipline field and a dropdown arrow appears to the right of the field. Click the dropdown, click (Select All)to remove all selections, then scroll down and select Archery, Diving, Fencing, Figure Skating, and Speed Skating. Click OK.

    2. Or, in the Row Labels section of the PivotTable, click the dropdown next to Row Labels in the PivotTable, click (Select All) to remove all selections, then scroll down and select Archery, Diving, Fencing, Figure Skating, and Speed Skating. Click OK.

  4. In PivotTable Fields, from the Medals table, drag Medal to the VALUES area. Since Values must be numeric, Excel automatically changes Medal to Count of Medal.

  5. From the Medals table, select Medal again and drag it into the FILTERS area.

  6. Let’s filter the PivotTable to display only those countries or regions with more than 90 total medals. Here’s how.

    1. In the PivotTable, click the dropdown to the right of Column Labels.

    2. Select Value Filters and select Greater Than….

    3. Type 90 in the last field (on the right). Click OK.
      Value Filter window

Your PivotTable looks like the following screen.

Updated PivotTable

With little effort, you now have a basic PivotTable that includes fields from three different tables. What made this task so simple were the pre-existing relationships among the tables. Because table relationships existed in the source database, and because you imported all the tables in a single operation, Excel could recreate those table relationships in its Data Model.

But what if your data originates from different sources, or is imported at a later time? Typically, you can create relationships with new data based on matching columns. In the next step, you import additional tables, and learn how to create new relationships.

Import data from a spreadsheet

Now let’s import data from another source, this time from an existing workbook, then specify the relationships between our existing data and the new data. Relationships let you analyze collections of data in Excel, and create interesting and immersive visualizations from the data you import.

Let’s start by creating a blank worksheet, then import data from an Excel workbook.

  1. Insert a new Excel worksheet, and name it Sports.

  2. Browse to the folder that contains the downloaded sample data files, and open OlympicSports.xlsx.

  3. Select and copy the data in Sheet1. If you select a cell with data, such as cell A1, you can press Ctrl + A to select all adjacent data. Close the OlympicSports.xlsx workbook.

  4. On the Sports worksheet, place your cursor in cell A1 and paste the data.

  5. With the data still highlighted, press Ctrl + T to format the data as a table. You can also format the data as a table from the ribbon by selecting HOME > Format as Table. Since the data has headers, select My table has headers in the Create Table window that appears, as shown here.

    Create Table window

    Formatting the data as a table has many advantages. You can assign a name to a table, which makes it easy to identify. You can also establish relationships between tables, enabling exploration and analysis in PivotTables, Power Pivot, and Power View.

  6. Name the table. In TABLE TOOLS > DESIGN > Properties, locate the Table Name field and type Sports. The workbook looks like the following screen.
    Name a table in Excel

  7. Save the workbook.

Import data using copy and paste

Now that we’ve imported data from an Excel workbook, let’s import data from a table we find on a web page, or any other source from which we can copy and paste into Excel. In the following steps, you add the Olympic host cities from a table.

  1. Insert a new Excel worksheet, and name it Hosts.

  2. Select and copy the following table, including the table headers.

City

NOC_CountryRegion

Alpha-2 Code

Edition

Season

Melbourne / Stockholm

AUS

AS

1956

Summer

Sydney

AUS

AS

2000

Summer

Innsbruck

AUT

AT

1964

Winter

Innsbruck

AUT

AT

1976

Winter

Antwerp

BEL

BE

1920

Summer

Antwerp

BEL

BE

1920

Winter

Montreal

CAN

CA

1976

Summer

Lake Placid

CAN

CA

1980

Winter

Calgary

CAN

CA

1988

Winter

St. Moritz

SUI

SZ

1928

Winter

St. Moritz

SUI

SZ

1948

Winter

Beijing

CHN

CH

2008

Summer

Berlin

GER

GM

1936

Summer

Garmisch-Partenkirchen

GER

GM

1936

Winter

Barcelona

ESP

SP

1992

Summer

Helsinki

FIN

FI

1952

Summer

Paris

FRA

FR

1900

Summer

Paris

FRA

FR

1924

Summer

Chamonix

FRA

FR

1924

Winter

Grenoble

FRA

FR

1968

Winter

Albertville

FRA

FR

1992

Winter

London

GBR

UK

1908

Summer

London

GBR

UK

1908

Winter

London

GBR

UK

1948

Summer

Munich

GER

DE

1972

Summer

Athens

GRC

GR

2004

Summer

Cortina d’Ampezzo

ITA

IT

1956

Winter

Rome

ITA

IT

1960

Summer

Turin

ITA

IT

2006

Winter

Tokyo

JPN

JA

1964

Summer

Sapporo

JPN

JA

1972

Winter

Nagano

JPN

JA

1998

Winter

Seoul

KOR

KS

1988

Summer

Mexico

MEX

MX

1968

Summer

Amsterdam

NED

NL

1928

Summer

Oslo

NOR

NO

1952

Winter

Lillehammer

NOR

NO

1994

Winter

Stockholm

SWE

SW

1912

Summer

St Louis

USA

US

1904

Summer

Los Angeles

USA

US

1932

Summer

Lake Placid

USA

US

1932

Winter

Squaw Valley

USA

US

1960

Winter

Moscow

URS

RU

1980

Summer

Los Angeles

USA

US

1984

Summer

Atlanta

USA

US

1996

Summer

Salt Lake City

USA

US

2002

Winter

Sarajevo

YUG

YU

1984

Winter

  1. In Excel, place your cursor in cell A1 of the Hosts worksheet and paste the data.

  2. Format the data as a table. As described earlier in this tutorial, you press Ctrl + T to format the data as a table, or from HOME > Format as Table. Since the data has headers, select My table has headers in the Create Table window that appears.

  3. Name the table. In TABLE TOOLS > DESIGN > Properties locate the Table Name field, and type Hosts.

  4. Select the Edition column, and from the HOME tab, format it as Number with 0 decimal places.

  5. Save the workbook. Your workbook looks like the following screen.

Host Table

Now that you have an Excel workbook with tables, you can create relationships between them. Creating relationships between tables lets you mash up the data from the two tables.

Create a relationship between imported data

You can immediately begin using fields in your PivotTable from the imported tables. If Excel can’t determine how to incorporate a field into the PivotTable, a relationship must be established with the existing Data Model. In the following steps, you learn how to create a relationship between data you imported from different sources.

  1. On Sheet1, at the top ofPivotTable Fields, clickAll to view the complete list of available tables, as shown in the following screen.
    Click All in PivotTable Fields to show all available tables

  2. Scroll through the list to see the new tables you just added.

  3. Expand Sports and select Sport to add it to the PivotTable. Notice that Excel prompts you to create a relationship, as seen in the following screen.
    The CREATE... relationship prompt in PivotTable Fields
     

    This notification occurs because you used fields from a table that’s not part of the underlying Data Model. One way to add a table to the Data Model is to create a relationship to a table that’s already in the Data Model. To create the relationship, one of the tables must have a column of unique, non-repeated, values. In the sample data, the Disciplines table imported from the database contains a field with sports codes, called SportID. Those same sports codes are present as a field in the Excel data we imported. Let’s create the relationship.

  4. Click CREATE… in the highlighted PivotTable Fields area to open the Create Relationship dialog, as shown in the following screen.

    Create Relationship window

  5. In Table, choose Disciplines from the drop down list.

  6. In Column (Foreign), choose SportID.

  7. In Related Table, choose Sports.

  8. In Related Column (Primary), choose SportID.

  9. Click OK.

The PivotTable changes to reflect the new relationship. But the PivotTable doesn’t look right quite yet, because of the ordering of fields in the ROWS area. Discipline is a subcategory of a given sport, but since we arranged Discipline above Sport in the ROWS area, it’s not organized properly. The following screen shows this unwanted ordering.
PivotTable with unwanted ordering

  1. In the ROWS area, move Sport above Discipline. That’s much better, and the PivotTable displays the data how you want to see it, as shown in the following screen.

    PivotTable with corrected ordering

Behind the scenes, Excel is building a Data Model that can be used throughout the workbook, in any PivotTable, PivotChart, in Power Pivot, or any Power View report. Table relationships are the basis of a Data Model, and what determine navigation and calculation paths.

In the next tutorial, Extend Data Model relationships using Excel 2013, Power Pivot, and DAX, you build on what you learned here, and step through extending the Data Model using a powerful and visual Excel add-in called Power Pivot. You also learn how to calculate columns in a table, and use that calculated column so that an otherwise unrelated table can be added to your Data Model.

Checkpoint and Quiz

Review What You’ve Learned

You now have an Excel workbook that includes a PivotTable accessing data in multiple tables, several of which you imported separately. You learned to import from a database, from another Excel workbook, and from copying data and pasting it into Excel.

To make the data work together, you had to create a table relationship that Excel used to correlate the rows. You also learned that having columns in one table that correlate to data in another table is essential for creating relationships, and for looking up related rows.

You’re ready for the next tutorial in this series. Here’s a link:

Extend Data Model relationships using Excel 2013, Power Pivot, and DAX

QUIZ

Want to see how well you remember what you learned? Here’s your chance. The following quiz highlights features, capabilities, or requirements you learned about in this tutorial. At the bottom of the page, you’ll find the answers. Good luck!

Question 1: Why is it important to convert imported data into tables?

A: You don’t have to convert them into tables, because all imported data is automatically turned into tables.

B: If you convert imported data into tables, they will be excluded from the Data Model. Only when they’re excluded from the Data Model are they available in PivotTables, Power Pivot, and Power View.

C: If you convert imported data into tables, they can be included in the Data Model, and be made available to PivotTables, Power Pivot, and Power View.

D: You cannot convert imported data into tables.

Question 2: Which of the following data sources can you import into Excel, and include in the Data Model?

A: Access Databases, and many other databases as well.

B: Existing Excel files.

C: Anything you can copy and paste into Excel and format as a table, including data tables in websites, documents, or anything else that can be pasted into Excel.

D: All of the above

Question 3: In a PivotTable, what happens when you reorder fields in the four PivotTable Fields areas?

A: Nothing – you cannot reorder fields once you place them in the PivotTable Fields areas.

B: The PivotTable format is changed to reflect the layout, but underlying data is unaffected.

C: The PivotTable format is changed to reflect the layout, and all underlying data is permanently changed.

D: The underlying data is changed, resulting in new data sets.

Question 4: When creating a relationship between tables, what is required?

A: Neither table can have any column that contains unique, non-repeated values.

B: One table must not be part of the Excel workbook.

C: The columns must not be converted to tables.

D: None of the above is correct.

Quiz Answers

  1. Correct answer: C

  2. Correct answer: D

  3. Correct answer: B

  4. Correct answer: D

Notes: Data and images in this tutorial series are based on the following:

  • Olympics Dataset from Guardian News & Media Ltd.

  • Flag images from CIA Factbook (cia.gov)

  • Population data from The World Bank (worldbank.org)

  • Olympic Sport Pictograms by Thadius856 and Parutakupiu

Abstract:    This is the first tutorial in a series designed to get you acquainted and comfortable using Excel and its built-in data mash-up and analysis features. These tutorials build and refine an Excel workbook from scratch, build a data model, then create amazing interactive reports using Power View. The tutorials are designed to demonstrate Microsoft Business Intelligence features and capabilities in Excel, PivotTables, Power Pivot, and Power View.

Note: This article describes data models in Excel 2013. However, the same data modeling and Power Pivot features introduced in Excel 2013 also apply to Excel 2016.

In these tutorials you learn how to import and explore data in Excel, build and refine a data model using Power Pivot, and create interactive reports with Power View that you can publish, protect, and share.

The tutorials in this series are the following:

  1. Import Data into Excel 2013, and Create a Data Model

  2. Extend Data Model relationships using Excel, Power Pivot, and DAX

  3. Create Map-based Power View Reports

  4. Incorporate Internet Data, and Set Power View Report Defaults

  5. Power Pivot Help

  6. Create Amazing Power View Reports — Part 2

In this tutorial, you start with a blank Excel workbook.

The sections in this tutorial are the following:

  • Import data from a database

  • Import data from a spreadsheet

  • Import data using copy and paste

  • Create a relationship between imported data

  • Checkpoint and Quiz

At the end of this tutorial is a quiz you can take to test your learning.

This tutorial series uses data describing Olympic Medals, hosting countries, and various Olympic sporting events. We suggest you go through each tutorial in order. Also, tutorials use Excel 2013 with Power Pivot enabled. For more information on Excel 2013, click here. For guidance on enabling Power Pivot, click here.

Import data from a database

We start this tutorial with a blank workbook. The goal in this section is to connect to an external data source, and import that data into Excel for further analysis.

Let’s start by downloading some data from the Internet. The data describes Olympic Medals, and is a Microsoft Access database.

  1. Click the following links to download files we use during this tutorial series. Download each of the four files to a location that’s easily accessible, such as Downloads or My Documents, or to a new folder you create:
    > OlympicMedals.accdb Access database
    > OlympicSports.xlsx Excel workbook
    > Population.xlsx Excel workbook
    > DiscImage_table.xlsx Excel workbook

  2. In Excel 2013, open a blank workbook.

  3. Click DATA > Get External Data > From Access. The ribbon adjusts dynamically based on the width of your workbook, so the commands on your ribbon may look slightly different from the following screens. The first screen shows the ribbon when a workbook is wide, the second image shows a workbook that has been resized to take up only a portion of the screen.

    Import data from Access

    Import data from Access with small ribbon

  4. Select the OlympicMedals.accdb file you downloaded and click Open. The following Select Table window appears, displaying the tables found in the database. Tables in a database are similar to worksheets or tables in Excel. Check the Enable selection of multiple tables box, and select all the tables. Then click OK.

    Select table window

  5. The Import Data window appears.

    Note: Notice the checkbox at the bottom of the window that allows you to Add this data to the Data Model, shown in the following screen. A Data Model is created automatically when you import or work with two or more tables simultaneously. A Data Model integrates the tables, enabling extensive analysis using PivotTables, Power Pivot, and Power View. When you import tables from a database, the existing database relationships between those tables is used to create the Data Model in Excel. The Data Model is transparent in Excel, but you can view and modify it directly using the Power Pivot add-in. The Data Model is discussed in more detail later in this tutorial.

    Select the PivotTable Report option, which imports the tables into Excel and prepares a PivotTable for analyzing the imported tables, and click OK.

    Import Data window

  6. Once the data is imported, a PivotTable is created using the imported tables.

    Blank Pivot Table

With the data imported into Excel, and the Data Model automatically created, you’re ready to explore the data.

Explore data using a PivotTable

Exploring imported data is easy using a PivotTable. In a PivotTable, you drag fields (similar to columns in Excel) from tables (like the tables you just imported from the Access database) into different areas of the PivotTable to adjust how it presents your data. A PivotTable has four areas: FILTERS, COLUMNS, ROWS, and VALUES.

The four PivotTable Fields areas

It might take some experimenting to determine which area a field should be dragged to. You can drag as many or few fields from your tables as you like, until the PivotTable presents your data how you want to see it. Feel free to explore by dragging fields into different areas of the PivotTable; the underlying data is not affected when you arrange fields in a PivotTable.

Let’s explore the Olympic Medals data in the PivotTable, starting with Olympic medalists organized by discipline, medal type, and the athlete’s country or region.

  1. In PivotTable Fields, expand the Medals table by clicking the arrow beside it. Find the NOC_CountryRegion field in the expanded Medals table, and drag it to the COLUMNS area. NOC stands for National Olympic Committees, which is the organizational unit for a country or region.

  2. Next, from the Disciplines table, drag Discipline to the ROWS area.

  3. Let’s filter Disciplines to display only five sports: Archery, Diving, Fencing, Figure Skating, and Speed Skating. You can do this from within the PivotTable Fields area, or from the Row Labels filter in the PivotTable itself.

    1. Click anywhere in the PivotTable to ensure the Excel PivotTable is selected. In the PivotTable Fields list, where the Disciplines table is expanded, hover over its Discipline field and a dropdown arrow appears to the right of the field. Click the dropdown, click (Select All)to remove all selections, then scroll down and select Archery, Diving, Fencing, Figure Skating, and Speed Skating. Click OK.

    2. Or, in the Row Labels section of the PivotTable, click the dropdown next to Row Labels in the PivotTable, click (Select All) to remove all selections, then scroll down and select Archery, Diving, Fencing, Figure Skating, and Speed Skating. Click OK.

  4. In PivotTable Fields, from the Medals table, drag Medal to the VALUES area. Since Values must be numeric, Excel automatically changes Medal to Count of Medal.

  5. From the Medals table, select Medal again and drag it into the FILTERS area.

  6. Let’s filter the PivotTable to display only those countries or regions with more than 90 total medals. Here’s how.

    1. In the PivotTable, click the dropdown to the right of Column Labels.

    2. Select Value Filters and select Greater Than….

    3. Type 90 in the last field (on the right). Click OK.
      Value Filter window

Your PivotTable looks like the following screen.

Updated PivotTable

With little effort, you now have a basic PivotTable that includes fields from three different tables. What made this task so simple were the pre-existing relationships among the tables. Because table relationships existed in the source database, and because you imported all the tables in a single operation, Excel could recreate those table relationships in its Data Model.

But what if your data originates from different sources, or is imported at a later time? Typically, you can create relationships with new data based on matching columns. In the next step, you import additional tables, and learn how to create new relationships.

Import data from a spreadsheet

Now let’s import data from another source, this time from an existing workbook, then specify the relationships between our existing data and the new data. Relationships let you analyze collections of data in Excel, and create interesting and immersive visualizations from the data you import.

Let’s start by creating a blank worksheet, then import data from an Excel workbook.

  1. Insert a new Excel worksheet, and name it Sports.

  2. Browse to the folder that contains the downloaded sample data files, and open OlympicSports.xlsx.

  3. Select and copy the data in Sheet1. If you select a cell with data, such as cell A1, you can press Ctrl + A to select all adjacent data. Close the OlympicSports.xlsx workbook.

  4. On the Sports worksheet, place your cursor in cell A1 and paste the data.

  5. With the data still highlighted, press Ctrl + T to format the data as a table. You can also format the data as a table from the ribbon by selecting HOME > Format as Table. Since the data has headers, select My table has headers in the Create Table window that appears, as shown here.

    Create Table window

    Formatting the data as a table has many advantages. You can assign a name to a table, which makes it easy to identify. You can also establish relationships between tables, enabling exploration and analysis in PivotTables, Power Pivot, and Power View.

  6. Name the table. In TABLE TOOLS > DESIGN > Properties, locate the Table Name field and type Sports. The workbook looks like the following screen.
    Name a table in Excel

  7. Save the workbook.

Import data using copy and paste

Now that we’ve imported data from an Excel workbook, let’s import data from a table we find on a web page, or any other source from which we can copy and paste into Excel. In the following steps, you add the Olympic host cities from a table.

  1. Insert a new Excel worksheet, and name it Hosts.

  2. Select and copy the following table, including the table headers.

City

NOC_CountryRegion

Alpha-2 Code

Edition

Season

Melbourne / Stockholm

AUS

AS

1956

Summer

Sydney

AUS

AS

2000

Summer

Innsbruck

AUT

AT

1964

Winter

Innsbruck

AUT

AT

1976

Winter

Antwerp

BEL

BE

1920

Summer

Antwerp

BEL

BE

1920

Winter

Montreal

CAN

CA

1976

Summer

Lake Placid

CAN

CA

1980

Winter

Calgary

CAN

CA

1988

Winter

St. Moritz

SUI

SZ

1928

Winter

St. Moritz

SUI

SZ

1948

Winter

Beijing

CHN

CH

2008

Summer

Berlin

GER

GM

1936

Summer

Garmisch-Partenkirchen

GER

GM

1936

Winter

Barcelona

ESP

SP

1992

Summer

Helsinki

FIN

FI

1952

Summer

Paris

FRA

FR

1900

Summer

Paris

FRA

FR

1924

Summer

Chamonix

FRA

FR

1924

Winter

Grenoble

FRA

FR

1968

Winter

Albertville

FRA

FR

1992

Winter

London

GBR

UK

1908

Summer

London

GBR

UK

1908

Winter

London

GBR

UK

1948

Summer

Munich

GER

DE

1972

Summer

Athens

GRC

GR

2004

Summer

Cortina d’Ampezzo

ITA

IT

1956

Winter

Rome

ITA

IT

1960

Summer

Turin

ITA

IT

2006

Winter

Tokyo

JPN

JA

1964

Summer

Sapporo

JPN

JA

1972

Winter

Nagano

JPN

JA

1998

Winter

Seoul

KOR

KS

1988

Summer

Mexico

MEX

MX

1968

Summer

Amsterdam

NED

NL

1928

Summer

Oslo

NOR

NO

1952

Winter

Lillehammer

NOR

NO

1994

Winter

Stockholm

SWE

SW

1912

Summer

St Louis

USA

US

1904

Summer

Los Angeles

USA

US

1932

Summer

Lake Placid

USA

US

1932

Winter

Squaw Valley

USA

US

1960

Winter

Moscow

URS

RU

1980

Summer

Los Angeles

USA

US

1984

Summer

Atlanta

USA

US

1996

Summer

Salt Lake City

USA

US

2002

Winter

Sarajevo

YUG

YU

1984

Winter

  1. In Excel, place your cursor in cell A1 of the Hosts worksheet and paste the data.

  2. Format the data as a table. As described earlier in this tutorial, you press Ctrl + T to format the data as a table, or from HOME > Format as Table. Since the data has headers, select My table has headers in the Create Table window that appears.

  3. Name the table. In TABLE TOOLS > DESIGN > Properties locate the Table Name field, and type Hosts.

  4. Select the Edition column, and from the HOME tab, format it as Number with 0 decimal places.

  5. Save the workbook. Your workbook looks like the following screen.

Host Table

Now that you have an Excel workbook with tables, you can create relationships between them. Creating relationships between tables lets you mash up the data from the two tables.

Create a relationship between imported data

You can immediately begin using fields in your PivotTable from the imported tables. If Excel can’t determine how to incorporate a field into the PivotTable, a relationship must be established with the existing Data Model. In the following steps, you learn how to create a relationship between data you imported from different sources.

  1. On Sheet1, at the top ofPivotTable Fields, clickAll to view the complete list of available tables, as shown in the following screen.
    Click All in PivotTable Fields to show all available tables

  2. Scroll through the list to see the new tables you just added.

  3. Expand Sports and select Sport to add it to the PivotTable. Notice that Excel prompts you to create a relationship, as seen in the following screen.
    The CREATE... relationship prompt in PivotTable Fields
     

    This notification occurs because you used fields from a table that’s not part of the underlying Data Model. One way to add a table to the Data Model is to create a relationship to a table that’s already in the Data Model. To create the relationship, one of the tables must have a column of unique, non-repeated, values. In the sample data, the Disciplines table imported from the database contains a field with sports codes, called SportID. Those same sports codes are present as a field in the Excel data we imported. Let’s create the relationship.

  4. Click CREATE… in the highlighted PivotTable Fields area to open the Create Relationship dialog, as shown in the following screen.

    Create Relationship window

  5. In Table, choose Disciplines from the drop down list.

  6. In Column (Foreign), choose SportID.

  7. In Related Table, choose Sports.

  8. In Related Column (Primary), choose SportID.

  9. Click OK.

The PivotTable changes to reflect the new relationship. But the PivotTable doesn’t look right quite yet, because of the ordering of fields in the ROWS area. Discipline is a subcategory of a given sport, but since we arranged Discipline above Sport in the ROWS area, it’s not organized properly. The following screen shows this unwanted ordering.
PivotTable with unwanted ordering

  1. In the ROWS area, move Sport above Discipline. That’s much better, and the PivotTable displays the data how you want to see it, as shown in the following screen.

    PivotTable with corrected ordering

Behind the scenes, Excel is building a Data Model that can be used throughout the workbook, in any PivotTable, PivotChart, in Power Pivot, or any Power View report. Table relationships are the basis of a Data Model, and what determine navigation and calculation paths.

In the next tutorial, Extend Data Model relationships using Excel 2013, Power Pivot, and DAX, you build on what you learned here, and step through extending the Data Model using a powerful and visual Excel add-in called Power Pivot. You also learn how to calculate columns in a table, and use that calculated column so that an otherwise unrelated table can be added to your Data Model.

Checkpoint and Quiz

Review What You’ve Learned

You now have an Excel workbook that includes a PivotTable accessing data in multiple tables, several of which you imported separately. You learned to import from a database, from another Excel workbook, and from copying data and pasting it into Excel.

To make the data work together, you had to create a table relationship that Excel used to correlate the rows. You also learned that having columns in one table that correlate to data in another table is essential for creating relationships, and for looking up related rows.

You’re ready for the next tutorial in this series. Here’s a link:

Extend Data Model relationships using Excel 2013, Power Pivot, and DAX

QUIZ

Want to see how well you remember what you learned? Here’s your chance. The following quiz highlights features, capabilities, or requirements you learned about in this tutorial. At the bottom of the page, you’ll find the answers. Good luck!

Question 1: Why is it important to convert imported data into tables?

A: You don’t have to convert them into tables, because all imported data is automatically turned into tables.

B: If you convert imported data into tables, they will be excluded from the Data Model. Only when they’re excluded from the Data Model are they available in PivotTables, Power Pivot, and Power View.

C: If you convert imported data into tables, they can be included in the Data Model, and be made available to PivotTables, Power Pivot, and Power View.

D: You cannot convert imported data into tables.

Question 2: Which of the following data sources can you import into Excel, and include in the Data Model?

A: Access Databases, and many other databases as well.

B: Existing Excel files.

C: Anything you can copy and paste into Excel and format as a table, including data tables in websites, documents, or anything else that can be pasted into Excel.

D: All of the above

Question 3: In a PivotTable, what happens when you reorder fields in the four PivotTable Fields areas?

A: Nothing – you cannot reorder fields once you place them in the PivotTable Fields areas.

B: The PivotTable format is changed to reflect the layout, but underlying data is unaffected.

C: The PivotTable format is changed to reflect the layout, and all underlying data is permanently changed.

D: The underlying data is changed, resulting in new data sets.

Question 4: When creating a relationship between tables, what is required?

A: Neither table can have any column that contains unique, non-repeated values.

B: One table must not be part of the Excel workbook.

C: The columns must not be converted to tables.

D: None of the above is correct.

Quiz Answers

  1. Correct answer: C

  2. Correct answer: D

  3. Correct answer: B

  4. Correct answer: D

Notes: Data and images in this tutorial series are based on the following:

  • Olympics Dataset from Guardian News & Media Ltd.

  • Flag images from CIA Factbook (cia.gov)

  • Population data from The World Bank (worldbank.org)

  • Olympic Sport Pictograms by Thadius856 and Parutakupiu

How to Import Data in Excel?

Importing the data from another file or another source file is often required in Excel. For example, sometimes people need data directly from very complicated servers, and sometimes we may need to import data from a text file or even from an Excel workbook.

If you are new to Excel data importing, then in this article, we will take a tour of importing data from text files, different Excel workbooks, and MS Access. Follow this article to learn the process involved in importing the data.

Table of contents
  • How to Import Data in Excel?
    • #1 – Import Data from Another Excel Workbook
    • #2 – Import Data from MS Access to Excel
    • #3 – Import Data from Text File to Excel
    • Things to Remember 
    • Recommended Articles

Import Data into Excel

#1 – Import Data from Another Excel Workbook

You can download this Import Data Excel Template here – Import Data Excel Template

Let us start.

  1. First, we must go to the DATA tab. Then, under the DATA tab, click on Connections.

    Import Data Example 1

  2. As soon as we click on Connections, we may see the below window separately.

    Import Data Example 1-1

  3. Now, click on Add.

    Import Data Example 1-2

  4. It will open up a new window. In the below window, select All Connections.

    Import Data Example 1-3

  5. If there are any connections in this workbook, it will show what those connections are here.

    Import Data Example 1-4

  6. Since we are connecting to a new workbook, click on Browse for more.

    Import Data Example 1-5

  7. In the below window, browse the file location. Then, click on Open.

    Import Data Example 1-6

  8. After clicking on Open, it shows the below window.

    Import Data Example 1-7

  9. Here, we need to select the required table to be imported to this workbook. Select the table and click on OK.

    Import Data Example 1-8

    After clicking on OK, close the Workbook Connection window.

  10. Then, go to Existing Connections under the DATA tab.

    Import Data Example 1-9

  11. Here, we will see all the existing connections. Select the connection we have just made and click on Open.

    Import Data Example 1-10

  12. Once we click on Open, it will ask us where to import the data. First, we need to select the cell reference here. Then, click on the OK button.

    Import Data Example 1-11

  13. It will import the data from the selected or connected workbook.

    Import Data Example 1-12

Like this, we can connect to the other workbook and import the data.

#2 – Import Data from MS Access to Excel

MS Access is the main platform to store the data safely. We can import the data directly from the MS Access File itself whenever the data is required.

Step 1: Go to the “DATA” ribbon in excelThe ribbon is an element of the UI (User Interface) which is seen as a strip that consists of buttons or tabs; it is available at the top of the excel sheet. This option was first introduced in the Microsoft Excel 2007.read more and select “From Access.

Import Data Example 2

Step 2: Now, it will ask us to locate the desired file. Select the desired file path. Then, click on “Open.”

Import Data Example 2-1

Step 3: Now, it will ask us to select the desired destination cell where we want to import the data. Then, click on “OK.”

Import Data Example 2-2

Step 4: It will import the data from access to the A1 cell in Excel.

Import Data Example 2-3

#3 – Import Data from Text File to Excel

In almost all the corporations, whenever we ask for the data from the IT team, they will write a query and get the file in TEXT format. But unfortunately, TEXT file data is not the ready format to use in Excel; we need to make some modifications to work on it.

Step 1: Go to the “DATA” tab and click on “From Text.”

Example 3

Step 2: Now, it will ask us to choose the file location on the computer or laptop. Select the targeted file, then click on “Import.”

Example 3-1

Step 3: It will open up a “Text Import Wizard.”

Text Import Wizard - Step 1 of 3

Step 4: By selecting the “Delimited,” click on “Next.”

Text Import Wizard - Step 1 of 3

Step 5: In the next window, select the other and mention comma (,) because, in the text file, each column is separated by a comma (,). Then click on “Next.”

Text Import Wizard - Step 2 of 3

Step 6: In the next window, click on “Finish.”

Text Import Wizard 3-5

Step 7: Now, it will ask us to select the desired destination cell where we want to import the data. Select the cell and click on “OK.”

Example 3-6

Step 8: It will import the data from the text file to the A1 cell in Excel.

Example 3-7

Things to Remember

  • If there are many tables, we must specify which table data we need to import.
  • If we want the data in the current worksheet, we need to select the desired cell. Else, if we need data in a new worksheet, we must choose the new worksheet as the option.
  • We need to separate the column in the TEXT file by identifying the common column separators.

Recommended Articles

This article is a guide to Import Data in Excel. Here, we discuss how to import data from 1) Excel Workbook, 2) MS Access, 3) Text File, practical examples, and a downloadable Excel template. You may learn more about Excel from the following articles: –

  • KPI Dashboard in Excel
  • Insert Image in Excel Cell
  • How to Insert New Worksheet In Excel?
  • Create a Dashboard in Excel
  • Page Numbers in Excel


How to Import & Export Data into Excel

Excel can import and export many different file types aside from the standard .xslx format. If your data is shared between other programs, like a database, you may need to save data as a different file type or bring in files of a different file type.

Export Data

When you have data that needs to be transferred to another system, export it from Excel in a format that can be interpreted by other programs, such as a text or CSV file.

  1. Click the File tab.

    Import and Export Data

  2. At the left, click Export.
  3. Click the Change File Type.
  4. Under Other File Types, select a file type.
    • Text (Tab delimited): The cell data will be separated by a tab.
    • CSV (Comma delimited): The cell data will be separated by a comma.
    • Formatted Text (space delimited): The cell data will be separated by a space.
    • Save as Another File Type: Select a different file type when the Save As dialog box appears.

    The file type you select will depend on what type of file is required by the program that will consume the exported data.

  5. Click Save As.

    Import and Export Data

  6. Specify where you want to save the file.
  7. Click Save.

    Import and Export Data

    A dialog box appears stating that some of the workbook features may be lost.

  8. Click Yes.

Import Data

Excel can import data from external data sources including other files, databases, or web pages.

  1. Click the Data tab on the Ribbon..
  2. Click the Get Data button.

    Some data sources may require special security access, and the connection process can often be very complex. Enlist the help of your organization’s technical support staff for assistance.

  3. Select From File.
  4. Select From Text/CSV.

    Import and Export Data

    If you have data to import from Access, the web, or another source, select one of those options in the Get External Data group instead.

  5. Select the file you want to import.
  6. Click Import.

    If, while importing external data, a security notice appears saying that it is connecting to an external source that may not be safe, click OK.

    Import and Export Data

  7. Verify the preview looks correct.

    Because we’ve specified the data is separated by commas, the delimiter is already set. If you need to change it, it can be done from this menu.

  8. Click Load.

    Import and Export Data


Excel Cheat Sheet

FREE Quick Reference

Click to Download

Free to distribute with our compliments; we hope you will consider our paid training.

Power Query is an extremely useful feature that allows us to:

  • connect to different data sources, like text files, Excel files, databases, websites, etc…
  • transform the data based on report prerequisites.
  • save the data into an Excel table, data model, or simply connect to the data for later loading.

The best part is that if the source data changes, you can update the destination results with a single click; something that is ideal for data that changes frequently.

This is analogous to recording and executing a macro.  But unlike a macro, the creation and execution of the back-end code happen automatically.

If you can click buttons, you can create automated Power Query solutions.

Example #1

Import Spot Prices for Petroleum

from a Website to Excel

The first step is to connect to the data source.  For this example, we will connect to the U.S. Energy Information Administration.

https://www.eia.gov/petroleum

The information we need is in a table that is part of the overall webpage.

In the “old days”, we would transfer the information from the website into Excel by highlighting the webpage table and copy/paste the data into Excel.

If you’ve ever done this, you know what a hit-or-miss proposition this can be.  It’s the 50/50/90 Rule: if you have a 50/50 chance of winning, you’ll lose 90% of the time.

Even if you were to successfully transfer the information into Excel, the information is not linked to the webpage.  When the webpage changes, you will need to recopy/paste (and potentially fix) the updated information.

  1. Begin by copying the URL from the webpage (assuming you are previewing the page in a browser). If not, you can type it into the next step’s URL prompt.
  2. Select Data (tab) -> Get & Transform (group) -> From Web.

  1. In the From Web dialog box, paste the URL into the URL field and click OK.

The Navigator window displays the components of the webpage in the left panel.

If you want to ensure you are on the correct webpage, click the tab labeled Web View to get a preview of the page in a traditional HTML format.

It is unlikely that the listed components on the left will be presented with obvious names as to which item goes to which webpage component. You may need to click from one item to the next, previewing each item in the right-side preview panel, in order to determine which belongs to the desired table.

If the data does not require any further transformations, you can click Load/Load To… to send the data directly to Excel.  This will allow you to select the destination of the results data, such as a table on a new or existing worksheet, the Data Model, or create a “Connection Only” to the source data.

  1. In the Navigator dialog box, select the arrow next to Load and click Load To…

  1. In the Import Data dialog box, select “Existing worksheet” and point to a cell on your desired destination worksheet (like cell A1 on “Sheet1”).

The result is a table that is connected to a query.  The Queries & Connections panel (right) lists all existing queries in this file.

If you hover over a query, an information window will appear giving you the following information:

  • a preview of the data
  • the number of imported columns
  • the last refresh date/time
  • how the data was loaded or connected to the Excel file
  • the location of the source data

Although the data looks correct, we have some structural issues with the results that will cause problems with further analysis.

The empty cells in the Product column will cause problems when sorting, filtering, charting, or pivoting the data.

We need to make some adjustments to the data.

  1. Double-click (or right-click and choose Edit) the listed query to activate the Power Query Editor.

We want to fill down the listed products into the lower, empty cells of the Product column.

  1. In the Power Query Editor, select the Product column and click Transform (tab) -> Any Column (group) -> Fill -> Down.

Nothing happened.

The reason the product names failed to repeat down through the empty cells is that Power Query did not interpret the cells as empty.  There may be some artifact from the webpage that exists in the cell that we can’t see.

We will replace all the “fake empty” cells with null values.  This should allow the Fill Down operation to work as expected.

  1. Select the Changed Type step in the Query Settings panel (right).

  1. Select the Product column and click Transform (tab) -> Any Column (group) -> Replace Values.

  1. Tell Power Query that you wish to insert this new step into the existing query by clicking Insert.

  1. In the Replace Values dialog box, leave the “Value To Find” field empty and type “null” (no quotes) in the “Replace With” field. Click OK when finished.

If you select the previously created “Filled Down” step at the bottom of the Query Settings panel you will see the updated results of the query.

  1. Update the query name to “Spot Prices”.

  1. Click the top part of the Close & Load button at the far-left of the Home

If we were to graph the data, and the data were to change, we can refresh our graph by clicking Data (tab) -> Queries & Connections (group) -> Refresh All or right-click on the data and select Refresh.

Query Options

There are some controllable options available by selecting Data (tab) -> Queries & Connections (group) -> Refresh All -> Connection Properties…

Some of the more popular options include:

  • Refresh the data every N number of minutes
  • Refresh the data when opening the file
  • Opting for participation during a Refresh All operation

Example #2

Import Weather Forecast

for the Next 10 Days

Imagine you work at the front desk of a popular hotel in New York City.  As a customer service, you wish to supply your guests with a printout of the weather forecast for the next 10 days.

This is something that needs to be printed every day where each successive day looks at its next 10 days.

  1. We start by searching for a website that can supply a 10-day forecast for Seattle.

  1. We take the first offer in the search results that takes us to weather.com.

  1. Now that we have the web link to the 10-day forecast for New York City, we will copy and paste it into a web query in Excel (Data (tab) -> Get & Transform (group) -> From Web).
  2. Select the table from the left side of the Navigator window.

We can see from the preview that there are some columns towards the right that we are not interested in and the column headers have shifted.

  1. In the Navigator window, select Transform Data to load the forecast into Power Query.
  2. Begin editing the data by right-clicking on the header for the “Day” column and select Remove.

  1. Select the last 3 columns (“Wind”, “Humidity”, and “Column7”) and remove them as well.
  2. Rename the remaining 3 columns.
    • Description -> Day
    • High / Low -> Description
    • Precip -> High/Low
  1. Rename the query “SeattleWeather”.
  2. On the Home tab, select the lower-part of the Close & Load button and click Close & Load To… and select Existing Worksheet from the Import Data dialog box. Click OK when complete.

We now have the weather forecast for the next 10 days.

Each day, we only need right-click the table to refresh the information.

Impressing the Boss

We really like the idea seen on the original weather.com website that displays a raincloud emoji for days that are expecting rain.

To bring a bit of fun to our report, we will have Excel display an umbrella emoji for any day that is forecasting rain or showers.

NOTE: This creative bit of Excel trickery is brought to us by our good friends Frédéric Le Guen and Oz du Soleil.  Links to their blog and video detail various uses of this trick can be found at the end of this post.

The first step is to add the umbrella emoji.  We will access the built-in Windows emoji library.

  1. On the keyboard, press the Windows key and the period to display the emoji library.

  1. Type the word “rain” to filter the emoji library to rain-related emojis.
  2. Select the umbrella with raindrops.

  1. Highlight the umbrella emoji in the Formula Bar and press Copy (CTRL-C) then Enter.
  2. Double-click the “SeattleWeather” query to launch the Power Query Editor.

The next step is to create a new column that adds the umbrella emoji for any row that contains the words “rain” or “shower” in the Description column.

  1. Select Add Column (tab) -> General (group) -> Conditional Column.

  1. The name of the new column is “Be Equipped” and the logic is “if the column named ‘Description’ contains the word ‘rain’ then display the umbrella emoji”. (Paste the umbrella emoji into the Output)
  2. Click the Add Clause button to create a second condition.
  3. The second description’s logic is “else if the column named ‘Description’ contains the word ‘shower’ then display the umbrella emoji”. (Paste the umbrella emoji into the Output)

  1. Click OK to add the new conditional column.

  1. Drag the header for “Be Equipped” so the new column lies between the “Description” and “High/Low” columns.

  1. Close & Load the updated query back into Excel.

Tomorrow, you only need right-click the table to load the updated 10-day weather forecast.

Interesting Links

Frédéric Le Guen’s blog post on adding emojis to your reports

Oz’s video – Emojis, Excel, Power Query & Dynamic Arrays

Practice Workbook

Feel free to Download the Workbook HERE.

Excel Download Practice file

Published on: December 15, 2019

Last modified: March 10, 2023

Microsoft Most Valuable Professional

Leila Gharani

I’m a 5x Microsoft MVP with over 15 years of experience implementing and professionals on Management Information Systems of different sizes and nature.

My background is Masters in Economics, Economist, Consultant, Oracle HFM Accounting Systems Expert, SAP BW Project Manager. My passion is teaching, experimenting and sharing. I am also addicted to learning and enjoy taking online courses on a variety of topics.

Понравилась статья? Поделить с друзьями:
  • Download excel 2010 for windows 10
  • Downloading 2007 microsoft word free
  • Download english word pronunciation
  • Download скачать microsoft word 2010
  • Download document word free download