Importing XML data to a list

The example in the preceding section used XML files that contained only a single record. XML files often contain multiple records, called repeating elements. Examples include a customer list or data for all employees in an organization.

You can use the Excel File ^ Open command to open an XML file that contains repeating elements. After you specify the filename, Excel presents the Open XML dialog box, as shown in Figure 4-6. This dialog box has three options:

♦ As an XML List: The file opens, and Excel converts the data to a List.

♦ As a Read-Only Workbook: The data is imported into the worksheet, but the workbook is read-only. This is to prevent you from accidentally overwriting the original file.

♦ Use the XML Source Task Pane: Excel infers the schema for the XML data and displays it in the task pane. (The data is not actually imported.) You can then map the elements to cells and import the actual data.

Figure 4-6: The Open XML dialog box.

Figure 4-6: The Open XML dialog box.

Figure 4-7 shows an XML file that has been imported to a worksheet.

Figure 4-7: The imported XML data.

When displayed in the task pane, repeating elements use a different icon (a double folder). Non-repeating elements display a single folder icon.

Was this article helpful?

0 0

Responses

Post a comment