Microsoft KB Archive/176894

= How To Append Data from a Single Sheet of an Excel Workbook =

Article ID: 176894

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q176894



SUMMARY
The undocumented SHEET clause of the APPEND FROM command allows you to import records from a specific sheet of a Microsoft Excel 5.0 workbook.



MORE INFORMATION
The following example shows how to import the data in a second sheet named sheet2 from an Excel workbook into a Visual FoxPro 3.0x or 5.0x table.

 Start Microsoft Excel version 5.0 or later. Create a new workbook.  In Sheet1 of the workbook, type the following in separate cells, A1 through C1: The    first     sheet   Click on Sheet2 of the workbook and type the following data in the cells of sheet2 beginning in cell A1 and ending in cell C3: The    first     record The    second    record The    third     record When this data is appended into the FoxPro table, it creates three records containing three fields.  Save the workbook in the Visual FoxPro home folder as a Microsoft Excel 5.0 Workbook (.xls) named Zbook1.xls and close Excel.  Start Visual FoxPro 3.0x or 5.0x and create a table using the following command: CREATE TABLE zjunk (first c(10), second c(10), third c(10))   Append the cells from Sheet2 to the first three records of table Ztest with the following command: APPEND FROM zbook1.xls TYPE XL5 SHEET SHEET2 When you browse the table you should see three records that contain the data from sheet2. </li></ol>

Keywords: kbhowto KB176894

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.