Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/101441

From BetaArchive Wiki
Knowledge Base

PRB: Importing MS Excel Spreadsheet Gives Field Names A, B, C

Article ID: 101441

Article Last Modified on 12/1/2003


  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft FoxPro 2.5b
  • Microsoft FoxPro 2.5a
  • Microsoft FoxPro 2.0
  • Microsoft FoxPro 2.5b for MS-DOS
  • Microsoft FoxPro 2.5a

This article was previously published under Q101441


Importing a Microsoft Excel spreadsheet into FoxPro results in incorrect field names. If the field names are designated as "Name", "Customer", and "Address" on the first row of the spreadsheet, they will show as "A", "B", and "C" in the FoxPro .DBF file.


By design, FoxPro will use the column headings, not a row of information, from a Microsoft Excel spreadsheet as the field names in the database created with the IMPORT command.


To work around this behavior, do the following in Microsoft Excel:

  1. On the spreadsheet you want to import into Microsoft FoxPro, select all the cells containing information.

NOTE: This should include the row containing the column headings.

  1. Do one of the following:

    • In Microsoft Excel version 5.0, from the Insert menu select Name Define, and then type database as the name. -or-

    • In Microsoft Excel version 4.0, from the Data menu, choose Set Database to set the range of the database boundaries.
  1. From the File menu, choose Save As and save the spreadsheet as type DBF4.
  2. Switch to FoxPro and open the DBF4 file; its extension is .DBF.

The field names will now be based on the first row of data from the Microsoft Excel spreadsheet.

Additional query words: VFoxWin FoxDos FoxWin

Keywords: KB101441