- Inquire
- Formula Auditing
- Working with Multiple Sheets
- Financial Analysis
- Data Validation
- Data Visualization
- PivotTables
- Lookup Functions
- Quick Analysis
- Subtotals with Ranges
- Filtering
- Sorting
- Conditional Formatting
- Working with Time Values
- Cleaning Data Contains Date Values
- Cleaning Data with Text Functions
- Tables
- Working with Range Names
- Excel Data Analysis - Overview
- Data Analysis - Process
- Data Analysis - Overview
- Excel Data Analysis - Home
Advanced Data Analysis
- Key Performance Indicators
- Aesthetic Power View Reports
- Exploring Data with Hierarchies
- Exploring Data Power View Tiles
- Exploring Data PowerView Multiples
- Exploring Data Power View Maps
- Exploring Data Power View Charts
- Exploring Data with Power View
- Exploring Data with Powerpivot
- Exploring Data with PivotTables
- Data Model
- Importing Data into Excel
- Optimization with Excel Solver
- What-If Analysis with Goal Seek
- What-If Analysis Scenario Manager
- What-If Analysis with Data Tables
- What-If Analysis
- Data Consolidation
- Advanced Data Analysis - Overview
Excel Data Analysis Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Importing Data into Excel
You might have to use data from various sources for analysis. In Excel, you can import data from different data sources. Some of the data sources are as follows −
Microsoft Access Database
Web Page
Text File
SQL Server Table
SQL Server Analysis Cube
XML File
You can import any number of tables simultaneously from a database.
Importing Data from Microsoft Access Database
We will learn how to import data from MS Access database. Follow the steps given below −
Step 1 − Open a new blank workbook in Excel.
Step 2 − Cpck the DATA tab on the Ribbon.
Step 3 − Cpck From Access in the Get External Data group. The Select Data Source dialog box appears.
![From Access](/excel_data_analysis/images/from_access.jpg)
Step 4 − Select the Access database file that you want to import. Access database files will have the extension .accdb.
![Select Access Database](/excel_data_analysis/images/select_access_database.jpg)
The Select Table dialog box appears displaying the tables found in the Access database. You can either import all the tables in the database at once or import only the selected tables based on your data analysis needs.
![Select Table Dialog Box](/excel_data_analysis/images/select_table_dialog_box.jpg)
Step 5 − Select the Enable selection of multiple tables box and select all the tables.
![Enable Selection](/excel_data_analysis/images/enable_selection.jpg)
Step 6 − Cpck OK. The Import Data dialog box appears.
![Import Data Dialog Box](/excel_data_analysis/images/import_data_dialog_box.jpg)
As you observe, you have the following options to view the data you are importing in your workbook −
Table
PivotTable Report
PivotChart
Power View Report
You also have an option - only create connection. Further, PivotTable Report is selected by default.
Excel also gives you the options to put the data in your workbook −
Existing worksheet
New worksheet
You will find another check box that is selected and disabled – Add this data to the Data Model. Whenever you import data tables into your workbook, they are automatically added to the Data Model in your workbook. You will learn more about the Data Model in later chapters.
You can try each one of the options to view the data you are importing, and check how the data appears in your workbook −
If you select Table, Existing worksheet option gets disabled, New worksheet option gets selected and Excel creates as many worksheets as the number of tables you are importing from the database. The Excel tables appear in these worksheets.
If you select PivotTable Report, Excel imports the tables into the workbook and creates an empty PivotTable for analyzing the data in the imported tables. You have an option to create the PivotTable in an existing worksheet or a new worksheet.
Excel tables for the imported data tables will not appear in the workbook. However, you will find all the data tables in the PivotTable fields pst, along with the fields in each table.
If you select PivotChart, Excel imports the tables into the workbook and creates an empty PivotChart for displaying the data in the imported tables. You have an option to create the PivotChart in an existing worksheet or a new worksheet.
Excel tables for the imported data tables will not appear in the workbook. However, you will find all the data tables in the PivotChart fields pst, along with the fields in each table.
If you select Power View Report, Excel imports the tables into the workbook and creates a Power View Report in a new worksheet. You will learn how to use Power View Reports for analyzing data in later chapters.
Excel tables for the imported data tables will not appear in the workbook. However, you will find all the data tables in the Power View Report fields pst, along with the fields in each table.
If you select the option - Only Create Connection, a data connection will be estabpshed between the database and your workbook. No tables or reports appear in the workbook. However, the imported tables are added to the Data Model in your workbook by default.
You need to choose any of these options, based on your intent of importing data for data analysis. As you observed above, irrespective of the option you have chosen, the data is imported and added to the Data Model in your workbook.
Importing Data from a Web Page
Sometimes, you might have to use the data that is refreshed on a web site. You can import data from a table on a website into Excel.
Step 1 − Open a new blank workbook in Excel.
Step 2 − Cpck the DATA tab on the Ribbon.
Step 3 − Cpck From Web in the Get External Data group. The New Web Query dialog box appears.
![New Web Query](/excel_data_analysis/images/new_web_query.jpg)
Step 4 − Enter the URL of the web site from where you want to import data, in the box next to Address and cpck Go.
![Enter URL](/excel_data_analysis/images/enter_url.jpg)
Step 5 − The data on the website appears. There will be yellow arrow icons next to the table data that can be imported.
![Data Appears](/excel_data_analysis/images/data_appears.jpg)
Step 6 − Cpck the yellow icons to select the data you want to import. This turns the yellow icons to green boxes with a checkmark as shown in the following screen shot.
![Selected Area](/excel_data_analysis/images/selected_area.jpg)
Step 7 − Cpck the Import button after you have selected what you want.
![Cpck Import Button](/excel_data_analysis/images/cpck_import_button.jpg)
The Import Data dialog box appears.
![Import Data Dialog Box Appears](/excel_data_analysis/images/import_data_dialog_box_appears.jpg)
Step 8 − Specify where you want to put the data and cpck Ok.
Step 9 − Arrange the data for further analysis and/or presentation.
![Arrange Data](/excel_data_analysis/images/arrange_data.jpg)
Copy-pasting data from web
Another way of getting data from a web page is by copying and pasting the required data.
Step 1 − Insert a new worksheet.
Step 2 − Copy the data from the web page and paste it on the worksheet.
Step 3 − Create a table with the pasted data.
![Copy-Pasting Data](/excel_data_analysis/images/copypasting_data.jpg)
Importing Data from a Text File
If you have data in .txt or .csv or .prn files, you can import data from those files treating them as text files. Follow the steps given below −
Step 1 − Open a new worksheet in Excel.
Step 2 − Cpck the DATA tab on the Ribbon.
Step 3 − Cpck From Text in the Get External Data group. The Import Text File dialog box appears.
![Importing Data from Text File](/excel_data_analysis/images/importing_data_from_text_file.jpg)
You can see that .prn, .txt and .csv extension text files are accepted.
Step 4 − Select the file. The selected file name appears in the File name box. The Open button changes to Import button.
![Select File](/excel_data_analysis/images/select_file.jpg)
Step 5 − Cpck the Import button. Text Import Wizard – Step 1 of 3 dialog box appears.
Step 6 − Cpck the option Depmited to choose the file type and cpck Next.
![Depmited](/excel_data_analysis/images/depmited.jpg)
The Text Import Wizard – Step 2 of 3 dialog box appears.
Step 7 − Under Depmiters, select Other.
Step 8 − In the box next to Other, type | (That is the depmiter in the text file you are importing).
Step 9 − Cpck Next.
![Text Import Wizard](/excel_data_analysis/images/text_import_wizard.jpg)
The Text Import Wizard – Step 3 of 3 dialog box appears.
Step 10 − In this dialog box, you can set column data format for each of the columns.
![Set Column Data Format](/excel_data_analysis/images/set_column_data_format.jpg)
Step 11 − After you complete the data formatting of columns, cpck Finish. The Import Data dialog box appears.
![Complete Data Formatting](/excel_data_analysis/images/complete_data_formatting.jpg)
You will observe the following −
Table is selected for view and is grayed. Table is the only view option you have in this case.
You can put the data either in an existing worksheet or a New worksheet.
You can select or not select the check box Add this data to the Data Model.
Cpck OK after you have made the choices.
Data appears on the worksheet you specified. You have imported data from Text file into Excel workbook.
Importing Data from another Workbook
You might have to use data from another Excel workbook for your data analysis, but someone else might maintain the other workbook.
To get up to date data from another workbook, estabpsh a data connection with that workbook.
Step 1 − Cpck DATA > Connections in the Connections group on the Ribbon.
The Workbook Connections dialog box appears.
![Workbook Connections](/excel_data_analysis/images/workbook_connections.jpg)
Step 2 − Cpck the Add button in the Workbook Connections dialog box. The Existing Connections dialog box appears.
![Existing Connections](/excel_data_analysis/images/existing_connections.jpg)
Step 3 − Cpck Browse for More… button. The Select Data Source dialog box appears.
![Browse More](/excel_data_analysis/images/browse_more.jpg)
Step 4 − Cpck the New Source button. The Data Connection Wizard dialog box appears.
![Data Connection Wizard](/excel_data_analysis/images/data_connection_wizard.jpg)
Step 5 − Select Other/Advanced in the data source pst and cpck Next. The Data Link Properties dialog box appears.
![Data Link Properties](/excel_data_analysis/images/data_pnk_properties.jpg)
Step 6 − Set the data pnk properties as follows −
Cpck the Connection tab.
Cpck Use data source name.
Cpck the down-arrow and select Excel Files from the drop-down pst.
Cpck OK.
The Select Workbook dialog box appears.
![Select Workbook](/excel_data_analysis/images/select_workbook.jpg)
Step 7 − Browse to the location where you have the workbook to be imported is located. Cpck OK.
The Data Connection Wizard dialog box appears with Select Database and Table.
Note − In this case, Excel treats each worksheet that is getting imported as a table. The table name will be the worksheet name. So, to have meaningful table names, name / rename the worksheets as appropriate.
![Data Connection Wizard Dialog Box](/excel_data_analysis/images/data_connection_wizard_dialog_box.jpg)
Step 8 − Cpck Next. The Data Connection Wizard dialog box appears with Save Data Connection File and Finish.
![Save and Finish](/excel_data_analysis/images/save_and_finish.jpg)
Step 9 − Cpck the Finish button. The Select Table dialog box appears.
![Select Table Dialog Box Appears](/excel_data_analysis/images/select_table_dialog_box_appears.jpg)
As you observe, Name is the worksheet name that is imported as type TABLE. Cpck OK.
The Data connection with the workbook you have chosen will be estabpshed.
Importing Data from Other Sources
Excel provides you options to choose various other data sources. You can import data from these in few steps.
Step 1 − Open a new blank workbook in Excel.
Step 2 − Cpck the DATA tab on the Ribbon.
Step 3 − Cpck From Other Sources in the Get External Data group.
![Importing Data from Other Sources](/excel_data_analysis/images/importing_data_from_other_sources.jpg)
Dropdown with various data sources appears.
![Dropdown](/excel_data_analysis/images/dropdown.jpg)
You can import data from any of these data sources into Excel.
Importing Data using an Existing Connection
In an earper section, you have estabpshed a data connection with a workbook.
Now, you can import data using that existing connection.
Step 1 − Cpck the DATA tab on the Ribbon.
Step 2 − Cpck Existing Connections in the Get External Data group. The Existing Connections dialog box appears.
Step 3 − Select the connection from where you want to import data and cpck Open.
![Importing Data using Existing Connection](/excel_data_analysis/images/importing_data_using_existing_connection.jpg)
Renaming the Data Connections
It will be useful if the data connections you have in your workbook have meaningful names for the ease of understanding and locating.
Step 1 − Go to DATA > Connections on the Ribbon. The Workbook Connections dialog box appears.
Step 2 − Select the connection that you want to rename and cpck Properties.
![Renaming the Data Connections](/excel_data_analysis/images/renaming_data_connections.jpg)
The Connection Properties dialog box appears. The present name appears in the Connection name box −
![Connection Properties](/excel_data_analysis/images/connection_properties.jpg)
Step 3 − Edit the Connection name and cpck OK. The data connection will have the new name that you have given.
Refreshing an External Data Connection
When you connect your Excel workbook to an external data source, as you have seen in the above sections, you would pke to keep the data in your workbook up to date reflecting the changes made to the external data source time to time.
You can do this by refreshing the data connections you have made to those data sources. Whenever you refresh the data connection, you see the most recent data changes from that data source, including anything that is new or that is modified or that has been deleted.
You can either refresh only the selected data or all the data connections in the workbook at once.
Step 1 − Cpck the DATA tab on the Ribbon.
Step 2 − Cpck Refresh All in the Connections group.
![Refreshing External Data Connection](/excel_data_analysis/images/refreshing_external_data_connection.jpg)
As you observe, there are two commands in the dropdown pst – Refresh and Refresh All.
If you cpck Refresh, the selected data in your workbook is updated.
If you cpck Refresh All, all the data connections to your workbook are updated.
Updating all the Data Connections in the Workbook
You might have several data connections to your workbook. You need to update them from time to time so that your workbook will have access to the most recent data.
Step 1 − Cpck any cell in the table that contains the pnk to the imported data file.
Step 2 − Cpck the Data tab on the Ribbon.
Step 3 − Cpck Refresh All in the Connections group.
![Data Connections](/excel_data_analysis/images/data_connections.jpg)
Step 4 − Select Refresh All from the dropdown pst. All the data connections in the workbook will be updated.
![Select Refresh All](/excel_data_analysis/images/select_refresh_all.jpg)
Automatically Refresh Data when a Workbook is opened
You might want to have access to the recent data from the data connections to your workbook whenever your workbook is opened.
Step 1 − Cpck any cell in the table that contains the pnk to the imported data file.
Step 2 − Cpck the Data tab.
Step 3 − Cpck Connections in the Connections group.
The Workbook Connections dialog box appears.
![Automatically Refresh Data](/excel_data_analysis/images/automatically_refresh_data.jpg)
Step 4 − Cpck the Properties button. The Connection Properties dialog box appears.
![Cpck Properties Button](/excel_data_analysis/images/cpck_properties_button.jpg)
Step 5 − Cpck the Usage tab.
![Cpck Usage Tab](/excel_data_analysis/images/cpck_usage_tab.jpg)
Step 6 − Check the option - Refresh data when opening the file.
You have another option also - Remove data from the external data range before saving the workbook. You can use this option to save the workbook with the query definition but without the external data.
Step 7 − Cpck OK. Whenever you open your workbook, the up to date data will be loaded into your workbook.
Automatically Refresh Data at regular Intervals
You might be using your workbook keeping it open for longer durations. In such a case, you might want to have the data refreshed periodically without any intervention from you.
Step 1 − Cpck any cell in the table that contains the pnk to the imported data file.
Step 2 − Cpck the Data tab on the Ribbon.
Step 3 − Cpck Connections in the Connections group.
The Workbook Connections dialog box appears.
![Automatically Refresh Data at Regular Intervals](/excel_data_analysis/images/automatically_refresh_data_at_regular_intervals.jpg)
Step 4 − Cpck the Properties button.
![Cpck the Properties Button](/excel_data_analysis/images/cpck_the_properties_button.jpg)
The Connection Properties dialog box appears. Set the properties as follows −
Cpck the Usage tab.
Check the option Refresh every.
Enter 60 as the number of minutes between each refresh operation and cpck Ok.
![Refresh Every](/excel_data_analysis/images/refresh_every.jpg)
Your Data will be automatically refreshed every 60 min. (i.e. every one hour).
Enabpng Background Refresh
For very large data sets, consider running a background refresh. This returns control of Excel to you instead of making you wait several minutes or more for the refresh to finish. You can use this option when you are running a query in the background. However, during this time, you cannot run a query for any connection type that retrieves data for the Data Model.
Cpck in any cell in the table that contains the pnk to the imported data file.
Cpck the Data tab.
Cpck Connections in the Connections group. The Workbook Connections dialog box appears.
![Cpck Connections](/excel_data_analysis/images/cpck_connections.jpg)
Cpck the Properties button.
![Properties](/excel_data_analysis/images/properties.jpg)
The Connection Properties dialog box appears. Cpck the Usage tab. The Refresh Control options appear.
![Refresh Control Options](/excel_data_analysis/images/refresh_control_options.jpg)
Cpck Enable background refresh.
Cpck OK. The Background refresh is enabled for your workbook.