Top Banner
Microsoft Excel 2013 ® ® Tutorial 11: Connecting to External Data
72

Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

Apr 02, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

Microsoft Excel 2013® ®

Tutorial 11: Connecting to External Data

Page 2: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 2

Objectives• Import data from a text file• Work with connections and external data

ranges• Define a trusted location• Understand databases and queries• Use the Query Wizard to import data from

several tables• Edit a query

Page 3: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 3

Objectives• Import tables from Access for use with a

PivotTable• Manage table relationships with PowerPivot• Create a Web query• Retrieve financial data using an Office app• Access data from an XML document• Work with XML data maps

Page 4: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 4

Visual Overview:Retrieving Text Data

Page 5: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 5

Visual Overview:Retrieving Text Data

Page 6: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 6

Exploring External Data Sources• Data that is stored in locations other than the

Excel workbook are known as data sources• Data source files can be stored in a variety of

formats, for example:– Historical data, long-term trends (text files)– Current trend information (databases)– Up-to-the-minute data (the Internet)

Page 7: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 7

Exploring External Data Sources

Page 8: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 8

Importing Data from Text Files• Text files– Simple, widely used format for storing raw,

unformatted data (text and numbers)– Useful for sharing data across software programs

and computer systems• Understanding Text File Formats– Use a delimiter (space, comma, or tab) to

separate columns of data– Use fixed-width text file to start each column at

the same location

Page 9: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Importing Data from Text Files

9

Page 10: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 10

Importing Data from Text Files• Starting the Text Import Wizard– Determines if data is fixed-width or delimited

format and, if delimited, what delimiter is used– Steps of Text Import Wizard• On the DATA tab, click From Text in the Get

External Data group• In the Import Text File dialog box, select the file

and click Import; the Text Import Wizard – Step 1 of 3 opens

Page 11: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Importing Data from Text Files

11

Page 12: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Text Files• Specifying the Starting Row– Can specify the file type:• Delimited – characters separate each field• Fixed-width – fields are aligned in columns with

spaces between each field– Can specify starting row other than first row– Indicate it data has headers– Click Next button to go to Text Import Wizard –

Step 2 of 3

New Perspectives on Microsoft Excel 2013 12

Page 13: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Text Files

New Perspectives on Microsoft Excel 2013 13

Page 14: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Text Files• Editing Column Breaks– Text Import Wizard needs to know where each

column begins and ends– The point at which one column ends and another

begins is the column break• Delimited format: delimiter determines column

breaks• Fixed-width format: wizard guesses locations of

column breaks

New Perspectives on Microsoft Excel 2013 14

Page 15: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 15

Importing Data from Text Files

Page 16: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Text Files• Formatting and Trimming Incoming Data– In Step 3 of 3, format the data in each column– General format is applied by default– To specify a format:• Select a column in the Data preview box• Click the appropriate option button in the

Column Data format section• Indicate if a column should not be imported

New Perspectives on Microsoft Excel 2013 16

Page 17: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Importing Data from Text Files

17

Page 18: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Text Files

New Perspectives on Microsoft Excel 2013 18

• Click Finish to import the selected data• Data can then be used to create a chart

Page 19: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 19

Exploring External Data Ranges and Connections• When data is imported into a worksheet, it is

stored within an external data range– Each external data range is given a defined name

based on the data source filename– Assigned name can be edited

• Excel can update (refresh) data ranges and connections manually or automatically

• Importing data creates a connection between the workbook and the text file

Page 20: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Exploring External Data Ranges and Connections

20

Page 21: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring External Data Ranges and Connections• Excel supports other properties for external

data ranges, which include:– Keep the contents of the external data range

current by reimporting or refreshing the data– Require the user to enter a password before data is

refreshed– Define whether the refreshed external data range

retains or replaces the formatting and layout– Define whether Excel inserts or overwrites cells

when new rows are added to the data range

New Perspectives on Microsoft Excel 2013 21

Page 22: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring External Data Ranges and Connections• Viewing a Data Connection– A data connection is like a pipeline from a data

source to one or more locations in the workbook

– The same data connection can link multiple data ranges, PivotTables, or PivotCharts

–When you import external content Excel establishes a connection between a data range and that data source

New Perspectives on Microsoft Excel 2013 22

Page 23: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring External Data Ranges and Connections• Viewing a Data Connection (con’t.)– To see where a data connection is being used, you

can view that connection’s properties

New Perspectives on Microsoft Excel 2013 23

Page 24: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring External Data Ranges and Connections• Modifying Data Connection Properties– You can modify data connection properties

New Perspectives on Microsoft Excel 2013 24

Page 25: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 25

Defining a Trusted Location• Once a trusted location is defined, Excel will

access the connection to the data source without prompting for confirmation that the connection is secure

Page 26: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Visual Overview:Excel Databases and Queries

26

Page 27: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Visual Overview:Excel Databases and Queries

27

Page 28: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 28

An Introduction to Databases• A database is a structured collection of data• Databases are commonly used as the data

sources for Excel workbooks• A database is divided into separate tables• Each table is arranged in columns and rows; also

referred to as fields and records– A field stores information about a specific

characteristic of a person, place, or thing– A record is a collection of fields

Page 29: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPAn Introduction to Databases• Excel can retrieve data directly from most

database programs

New Perspectives on Microsoft Excel 2013 29

Page 30: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPAn Introduction to Databases• Different tables are connected through database

relationships; fields common to each table are used to match records in different table

• A one-to-one relationship is one in which one record in a table is matched to exactly one record from a second table

• A one-to-many relationship is one in which one record is matched to one or more records in a second table

• Relational databases are ones in which tables can be joined through the use of common fields

New Perspectives on Microsoft Excel 2013 30

Page 31: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPAn Introduction to Databases

New Perspectives on Microsoft Excel 2013 31

Page 32: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 32

Retrieving Data with Microsoft Query• Create a query to extract specific information

from a database• A query contains a set of criteria that specify

what values to retrieve and in what order• Queries are written in a language called SQL

or Structured Query Language• Microsoft Query uses a wizard containing a

collection of dialog boxes that guide you through the entire query process

Page 33: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 33

Retrieving Data with Microsoft Query• To start Microsoft Query Wizard:– Click the From Other Sources button in the Get

External Data group on the DATA tab– Click From Microsoft Query

Page 34: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 34

Retrieving Data with Microsoft Query• Connecting to a Data Source– There are several types of data sources from

which you can retrieve data– You can define your own data source by clicking

<New Data Source> in the list of databases– Once connected to the data source, the Query

Wizard – Choose Columns dialog box opens

Page 35: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data with Microsoft Query

New Perspectives on Microsoft Excel 2013 35

Page 36: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data with Microsoft Query• Choosing Tables and Fields– Choose table and fields to include in the query

New Perspectives on Microsoft Excel 2013 36

Page 37: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data with Microsoft Query• Filtering and Sorting Data– Determine whether to retrieve all records or to

filter data to retrieve only records that satisfy particular criteria

New Perspectives on Microsoft Excel 2013 37

Page 38: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data with Microsoft Query• Filtering and Sorting Data (con’t)• Specify how to sort the data by values in fields

New Perspectives on Microsoft Excel 2013 38

Page 39: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Retrieving Data with Microsoft Query• The Query Wizard – Finish dialog box provides three

options:– Return (import) the data into the Excel workbook– Display the results of the query in Microsoft Query– Save the query to a file

39

Page 40: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Retrieving Data with Microsoft Query• Editing a Query– Add new columns to a worksheet– Change the sort order options– Revise any filters– Edit a query by editing the definition of the

connection; Query Wizard will restart– Modify the query definition as you walk through

the steps of the wizard

40

Page 41: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Multiple Tables into a PivotTable• Import multiple tables from a database directly

into Excel without using Microsoft Query• If tables are related through a common field,

Excel will automatically include the relationship

• The entire table will be imported because the query is not defined

New Perspectives on Microsoft Excel 2013 41

Page 42: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Multiple Tables into a PivotTable

New Perspectives on Microsoft Excel 2013 42

Page 43: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Multiple Table Into a PivotTable• To import a table:– Click the From Access button in the Get External

Data group on the DATA tab– Select from the Select Data Source dialog box

New Perspectives on Microsoft Excel 2013 43

Page 44: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from Multiple Table Into a PivotTable• Set up and format the PivotTable and slicer

New Perspectives on Microsoft Excel 2013 44

Page 45: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring the Data Model and PowerPivot• The data model is a database built into Excel that

provides database tools• Data model database contents are immediately

available to PivotTables, PivotCharts, and other Excel features

• The data model is constructed from different tables related by common fields

• Installing the PowerPivot Add-In– Interact with the data model using PowerPivot –

an add-in for Excel 2013 that provides tools for performing advanced data analysis and modeling

New Perspectives on Microsoft Excel 2013 45

Page 46: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring the Data Model and PowerPivot• Installing the PowerPivot Add-In (con’t)– With PowerPivot, you can:• Apply filters to tables stored in the data model• Rename tables and fields within the data model• Define and manage the relationships among data

tables joined by common fields• Format data values that will be used in PivotTables

and other Excel reports• Create calculated fields based on data fields from

multiple data sources• Create advanced data structures and models

New Perspectives on Microsoft Excel 2013 46

Page 47: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring the Data Model and PowerPivot• Adding a Table to the Data Model– The POWERPIVOT tab contains the

commands from working with the data model–Use the Add to Data Model command to add

Excel tables to the data model–PowerPivot displays the contents of the data

model in a separate window from the Excel workbook window

New Perspectives on Microsoft Excel 2013 47

Page 48: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring the Data Model and PowerPivot

New Perspectives on Microsoft Excel 2013 48

Page 49: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring the Data Model and PowerPivot• Viewing the Data Model– View the contents of a data model in Data view

and in Diagram view– Data view shows the contents of each database

table in the data model on a separate tab– Diagram view shows each table as an icon and

relationships between tables are indicated by connecting arrows

– To see which field joins two tables, click the arrow connecting the tables

New Perspectives on Microsoft Excel 2013 49

Page 50: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring the Data Model and PowerPivot

New Perspectives on Microsoft Excel 2013 50

Page 51: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPExploring the Data Model and PowerPivot• Managing Relationships in the Data Model– To match records of one table to that of other

tables, create a relationship between tables– When creating a relationship, identify a field in

each table that will be used to match records

New Perspectives on Microsoft Excel 2013 51

Page 52: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Visual Overview:Web and XML Connections

52

Page 53: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Visual Overview:Web and XML Connections

53

Page 54: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013

Creating a Web Query• To keep an Excel workbook in sync with data

store on a website, create a query that retrieves data from a webpage

• To create this web query, you need the URL of the page you are accessing– If the file is stored on a web server, it follows the

format: http://server/path/filename– If the file is stored locally, it follows the format: file:///drive:/path/filename

54

Page 55: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 55

Creating a Web Query• To open the New Web Query dialog box, click

the From Web button in the Get External Data group on the DATA tab

Page 56: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPCreating a Web Query• Formatting a Web Query– Can format text imported from the web query– Formatting is preserved when Excel refreshes data– Can also retrieve the webpage data and the styles• None imports text, not formatting• Rich Text Format (RTF) allows for text

formatting styles but not advanced features• Full HTML retrieves all simple as well as

advanced HTML formatting features

New Perspectives on Microsoft Excel 2013 56

Page 57: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPCreating a Web Query

New Perspectives on Microsoft Excel 2013 57

Page 58: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPCreating a Web Query• Saving a Web Query–Can save a web query to a permanent file

that you share among other Office documents– The saved connection file can be loaded in

any Office program

New Perspectives on Microsoft Excel 2013 58

Page 59: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data Using Office Apps• Excel can be used with Office apps, which are

small, specialized programs that enhance the features of Excel, Word, PowerPoint, and other programs in the Office suite

• Office apps can retrieve articles from online encyclopedias, insert maps, and retrieve timely stock quotes and financial information

New Perspectives on Microsoft Excel 2013 59

Page 60: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data Using Office Apps• Inserting and Office App–Apps are downloaded from the Microsoft

Office Store; most apps are free – To download and use Office apps, you need

an account with Microsoft Office; the account is free, requiring only a username and password to set up

New Perspectives on Microsoft Excel 2013 60

Page 61: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data Using Office Apps

New Perspectives on Microsoft Excel 2013 61

Page 62: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data Using Office Apps• Retrieving Stock Market Data– Use the Bing Finance app to import current stock

market data into a workbook– Provides current price quotes and news on stocks

New Perspectives on Microsoft Excel 2013 62

Page 63: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPRetrieving Data Using Office Apps• Retrieving Stock Market Data (con’t)– App shows the current price of the stock and the

change in price since the market opened

New Perspectives on Microsoft Excel 2013 63

Page 64: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 64

Importing Data from XML• XML is a language used to create structured

documents using only text• Office files are saved in an XML format called

the Office Open XML

Page 65: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 65

Importing Data from XML• Each piece of data in an XMP document is

contained within an element• Data is marked by an opening and closing tag• XML documents are structured like a tree in

which elements are placed within one another, descending from a common root element

• The structure of the document is displayed in a data map

Page 66: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 66

Importing Data from XML• XML author can create rules specifying:– Which elements are required– What types of values are allowed within each

element• Rules are stored in a second document called

the schema– Not required in XML– Are useful in ensuring the integrity and validity of

XML data

Page 67: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXPImporting Data from XML• Editing an XML File– Before importing data, you can edit it– The first step in connecting a workbook to an XML

document is to generate the data map– After Excel has generated a data map, you can use

it to place XML content anywhere within the workbook

New Perspectives on Microsoft Excel 2013 67

Page 68: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 68

Importing Data from XML• Loading an XML Data Map– Commands to access the data map of an XML

document are part of Excel Developer tools– To work with an XML data map, you must show

the DEVELOPER tab on the ribbon– If the XML document has a schema file

attached to it, you can load a data map without actually importing the data into the Excel workbook

Page 69: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 69

Importing Data from XML• Binding XML Elements to a Worksheet– Using XML as a data source, allows you to attach

(bind) elements to specific cells in the workbook

Page 70: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 70

Importing Data from XML• Importing XML Data– You can import XML data directly into

worksheet cells– To retrieve XML data, refresh the connection to

the data source– Excel automatically places data in the correct

worksheet cells– Can automatically update XML data in a

workbook to reflect changes to the source XML document

Page 71: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 71

Importing Data from XML

Page 72: Microsoft Excel 2013 ®® Tutorial 11: Connecting to External Data.

XPXPXP

New Perspectives on Microsoft Excel 2013 72

Using Real-Time Data Acquisition• Another data source: real-time data

acquisition values from measuring devices and scientific equipment

• Usually requires purchase of an add-in to manage communication between Excel and the measuring device

• Excel provides the RTD function to facilitate real-time data acquisition

• Can save hours of data entry time