Import Wizard
You can use the Import wizard to move data into Visual FoxPro table (.dbf) files from other file formats, such as plain text, Microsoft Excel, or Word, and other files. For example, you might have a list of names and addresses in a Word file that you would find easier to use and more effective if it were in a Visual FoxPro table.
To access the Import wizard
- From the Tools menu, choose Wizards, and click Import.
Step 1 – Identify Data
In this step, you identify the type and location of the data you want to import.
- File Type drop-down list
Provides a list of known file types from which you can choose. - Source File edit box
Makes it possible for you to choose or to specify a file name and location. If you do not know either you can use the Locate button to find the file. - New table radio button
When you specify a destination file name and location, the wizard prompts you with a new table name in the same directory. The edit box makes it possible for you to specify a different name or location for the destination file. You can use the Locate button to specify another new file and location. - Existing table radio button
If you choose this button, the edit box makes it possible for you to specify the name and location of an existing file. If you do not know either you can use the Locate button to find the file.
Step 1a – Select a Database
In this step you can specify a database to which your table is added. You also can decide to import your data into a stand-alone table. If you choose a database, you can have enhancements like automatic and custom formatting options. For information on database enhancements, see Creating a Database
Step 2 – Determine Data Format
In this step, you can specify how the imported data was formatted — with or without delimiting characters between fields or columns and rows or as a single fixed-width column. You also can specify where within the file you want to begin importing data.
Delimited
Specifies that the fields in the file are separated by a character, such as a comma (,) or a semicolon (;).Fixed Width
Specifies that the fields in the file are aligned in columns.Field names in row
Makes it possible for you to specify the row of imported data that contains the field names. For instance, if the first line of your imported data contains the desired field names, set Field names in row to 1. If, however, field names are not part of the imported data, then in Step 3, you can specify field names for the new table.The Import wizard automatically replaces spaces with underscores and reduces field name size to fit the 10-character maximum.
Begin import at row
Makes it possible for you to specify the starting row of data in the imported file. This option makes it possible for you to avoid importing header data.
If you are importing a spreadsheet, this step offers a drop-down list of worksheets available in the selected spreadsheet.
Step 2a – Describe Data or Set Columns
Step 2a of the Import wizard only appears if you have chosen to import a text (.txt) file. Depending on what you chose as the Data format in step 2, you will get one of two options for step 2a: Describe Data or Set Columns.
Describe Data
This step appears as Describe Data, if you select Delimited as the Data format in step 2. Select what delimiter separates the text strings in the selected file. View the effect of the delimiter selected in the Field grid in the lower portion of this wizard dialog box.
Set Columns
This step appears as Set Columns, if you select Fixed Width as the Data format in step 2. You can use the Field grid in the lower portion of this wizard dialog box to specify more columns by clicking below the displayed data, so the imported information is divided into discrete fields.
Step 3 - Define Imported Fields
In this step, you specify the name of the columns in the table, the data type of the columns, and the width of the columns. Click below the existing heading of the column in the Field grid and edit the information listed in the Name, Type, Width, and Decimal drop-down lists.
If you do not want to import a specific column, click below the existing heading, and then press DELETE. The space for the column will still be visible (without a column heading name), but when you finish the wizard and import the data, that column will be ignored.
- Worksheet
Specifies the name of the worksheet if you are importing an Excel spreadsheet. - Field Grid
For a text file, this grid displays, at the bottom of the wizard dialog box, the record number and data as it is found in the file. For other types of files, it displays the file data as it will appear when you have completed the Import wizard.
Step 3a – Specify International Options
In this step, you can specify alternative settings for internationalization of the data to be imported into the table. You can choose to change the code page, currency symbol, 1000 separator, decimal separator, and date format.
- Code Page button
Changing the code page can affect the way your charts appear, because the characters that form lines and corners differ among code pages. This option makes it possible for you to select from code pages supported by Visual FoxPro. - Currency Symbol edit box
This setting makes it possible for you to override the default currency setting for the file created by this wizard. - 1000 Separator edit box
This setting makes it possible for you to override the default 1000 separator for the file created by the Import wizard. - Decimal Separator
This setting makes it possible for you to override the default decimal separator for the file created by the Import wizard. - Date Format
This option makes it possible for you to select one of the date formats supported by Visual FoxPro. For more information, see Dateformat Property.
See Also
Wizards Overview | Graph Wizard | Importing Data with the Import Wizard | Importing and Exporting Data | Developing International Applications | Dateformat Property