Tutorial 11: Connecting to External Data

7,677 views

Published on

Published in: Education

Tutorial 11: Connecting to External Data

  1. 1. Tutorial 11:Connecting to External Data Microsoft Excel 2010 ® ®
  2. 2. Visual Overview XPNew Perspectives on Microsoft Excel 2010 2
  3. 3. Retrieving Text Data XPNew Perspectives on Microsoft Excel 2010 3
  4. 4. Exploring External Data Sources XP • Historical data, long-term trends (text files) • Current trend information (databases) • Up-to-the-minute data (the Internet)New Perspectives on Microsoft Excel 2010 4
  5. 5. Importing Data from Text Files XP • Text files – Simple, widely used format for storing raw, unformatted data (text and numbers) – Useful for sharing data across software programs and computer systems • Ways to structure file contents – Use a delimiter • Columns of data are separated by a symbol – Use fixed-width text file • Each column starts at the same locationNew Perspectives on Microsoft Excel 2010 5
  6. 6. Understanding Text File Formats XP • Delimited text • Fixed-width textNew Perspectives on Microsoft Excel 2010 6
  7. 7. Importing Data from Text Files XP • Text Import Wizard determines whether data is fixed-width or delimited format • Steps of Text Import Wizard – Start the wizard – Specify starting row; edit column breaks • Delimited format: delimiter determines column breaks • Fixed-width format: wizard guesses locations of column breaks – Format data in each columnNew Perspectives on Microsoft Excel 2010 7
  8. 8. Starting the Text Import Wizard XPNew Perspectives on Microsoft Excel 2010 8
  9. 9. Specifying the Starting Row XPNew Perspectives on Microsoft Excel 2010 9
  10. 10. Formatting and Trimming Incoming XP DataNew Perspectives on Microsoft Excel 2010 10
  11. 11. Exploring Connections XP • Defined process of retrieving data from an external file • Importing data creates a connection between the workbook and the text fileNew Perspectives on Microsoft Excel 2010 11
  12. 12. Exploring Data Ranges XP • External data range – Each location in which a connection is applied • Each external data range is given a name, which can be edited • Excel can update (refresh) data ranges and connections manually or automaticallyNew Perspectives on Microsoft Excel 2010 12
  13. 13. Exploring Data Ranges XPNew Perspectives on Microsoft Excel 2010 13
  14. 14. Defining a Trusted Location XP • Once a trusted location is defined, Excel will access the connection to the data source without prompting for confirmation that the connection is secureNew Perspectives on Microsoft Excel 2010 14
  15. 15. Visual Overview XPNew Perspectives on Microsoft Excel 2010 15
  16. 16. Excel Databases and Queries XPNew Perspectives on Microsoft Excel 2010 16
  17. 17. Introducing Databases XP • Excel can retrieve data directly from most database programs • A common field can match information from two tables into a single tableNew Perspectives on Microsoft Excel 2010 17
  18. 18. Introducing Queries XP • Create a query to look at only specific information from a database • A query can: – Contain criteria (conditions that limit the number of records in the results) – Specify how you want the data to appearNew Perspectives on Microsoft Excel 2010 18
  19. 19. Using Microsoft Query XP • Excel supports two ways of importing database data – Create a connection to the database and retrieve all the information from a single table – Use Microsoft Query to retrieve data from multiple tablesNew Perspectives on Microsoft Excel 2010 19
  20. 20. Steps in the Microsoft Query Wizard XP • Create a data source • Choose table and fields (columns) to include • Determine whether to retrieve all records or to filter data to retrieve only records that satisfy particular criteria • Specify how to sort the dataNew Perspectives on Microsoft Excel 2010 20
  21. 21. Creating a Data Source XP • Choose Data Source dialog boxNew Perspectives on Microsoft Excel 2010 21
  22. 22. Choose Table and Fields (Columns) XPNew Perspectives on Microsoft Excel 2010 22
  23. 23. Choose Table and Fields (Columns) XPNew Perspectives on Microsoft Excel 2010 23
  24. 24. Filtering and Sorting Data XP • Filter Data dialog box • Sort Order dialog boxNew Perspectives on Microsoft Excel 2010 24
  25. 25. Saving a Query XP • Can be run later without redefining it • Accessible to other network users • Appears on Queries tab of Choose Data Source dialog box (allows quick access) • Save to trusted locations so that Excel can update queries when workbook is openedNew Perspectives on Microsoft Excel 2010 25
  26. 26. Importing Data from Microsoft Query XP • Query Wizard – Finish dialog box options – Return (import) data into the Excel workbook – Display results in Microsoft Query for further editing and query definition • Import data in an Excel table, a PivotTable, a PivotTable and PivotChart, or create the connection without importing the dataNew Perspectives on Microsoft Excel 2010 26
  27. 27. Importing Data from Microsoft Query XP • Formatted Portfolio worksheetNew Perspectives on Microsoft Excel 2010 27
  28. 28. Importing Data from Microsoft Query XP • Connection Properties dialog boxNew Perspectives on Microsoft Excel 2010 28
  29. 29. Editing a Query XP • Edit a query to: – Add new columns to the worksheet – Change sort order options – Specify a filter • Edit a query by editing the definition of the connection – Excel recognizes that Query Wizard was used to define parameters of the connection and restarts the wizardNew Perspectives on Microsoft Excel 2010 29
  30. 30. Editing a Query XPNew Perspectives on Microsoft Excel 2010 30
  31. 31. Editing a Query XP • Revised portfolio tableNew Perspectives on Microsoft Excel 2010 31
  32. 32. Importing Data into PivotTables and XP PivotCharts • Can select and display values from only one area at a time, adding only a single table and chart to the workbook • Data used in the table and chart can be stored in an external data source • Initial table and chart are empty until you define where to place fields from data sourceNew Perspectives on Microsoft Excel 2010 32
  33. 33. Importing Data into PivotTables and XP PivotCharts • PivotTable and PivotChart added to worksheetNew Perspectives on Microsoft Excel 2010 33
  34. 34. Importing Data into PivotTables XP • Can set PivotTable layout, change labels, and format data valuesNew Perspectives on Microsoft Excel 2010 34
  35. 35. Importing Data into PivotCharts XP • Can format PivotChartsNew Perspectives on Microsoft Excel 2010 35
  36. 36. Visual Overview XPNew Perspectives on Microsoft Excel 2010 36
  37. 37. Web and XML Connections XPNew Perspectives on Microsoft Excel 2010 37
  38. 38. Creating a Web Query XP • Specify the URL and use Excel Web Query to select portions of the Web page to import – URL form if file is stored on a Web server – URL form if file is stored locally (not on Web server)New Perspectives on Microsoft Excel 2010 38
  39. 39. Creating a Web Query XP • New Web Query dialog boxNew Perspectives on Microsoft Excel 2010 39
  40. 40. Creating a Web Query XP • Text is imported into worksheet as unformatted textNew Perspectives on Microsoft Excel 2010 40
  41. 41. Creating a Web Query XP • To format a Web query, retrieve Web page format using: – None (default; imports text but not formatting) – Rich text formatting only – Full HTML formatting • To save a Web query – Save to a permanent file that is shared – Saved connection file can be loaded in any Office programNew Perspectives on Microsoft Excel 2010 41
  42. 42. Importing Data from the Web XP • Use a Web query to retrieve online data and import it into a workbook • Excel has several Web query files stored in a library of built-in Web queries – Some include parameters for specifying exact information to be importedNew Perspectives on Microsoft Excel 2010 42
  43. 43. Importing Data from XML XP • Office 2010 files are stored in an XML-based file format called Office Open XML format • An XML document is structured like a tree: elements are placed within one another, descending from a common root elementNew Perspectives on Microsoft Excel 2010 43
  44. 44. Importing Data from XML XP • Data map of the Data.xml documentNew Perspectives on Microsoft Excel 2010 44
  45. 45. Importing Data from XML XP • XML author can: – Define what makes up a valid document (which elements are required, which are optional) – Indicate the type of values each element can contain • Schemas, though not required in XML, ensure that data inserted into an XML document follows predefined rules for content and structureNew Perspectives on Microsoft Excel 2010 45
  46. 46. Loading an XML Data Map XP • Commands to access data map of an XML document are part of Excel Developer tools • Show the Developer tab on the RibbonNew Perspectives on Microsoft Excel 2010 46
  47. 47. Binding XML Elements to a Worksheet XP • Using XML as a data source: – Allows you to attach (bind) elements to specific cells in the workbook – Provides greater freedom in designing worksheet layoutNew Perspectives on Microsoft Excel 2010 47
  48. 48. Importing XML Data XP • 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 source XML document • Can use a data map to export data from a worksheet to an XML documentNew Perspectives on Microsoft Excel 2010 48
  49. 49. Understanding Real-Time Data XP Acquisition • Another data source: real-time data values from measuring devices and scientific equipment • Usually requires purchase of an add-in to work with Excel and the device • Excel provides the RTD function to facilitate importing data from an external device • Can save hours of data entry timeNew Perspectives on Microsoft Excel 2010 49

×