EXPORT Command

See Also

Copies data from a Visual FoxPro table to a file in a different format.

Syntax

EXPORT TO FileName
  [TYPE] DIF | MOD | SYLK
     | WK1 | WKS | WR1 | WRK | XLS | XL5
  [FIELDS FieldList]
  [Scope]
  [FOR lExpression1]
  [WHILE lExpression2]
  [NOOPTIMIZE]
  [AS nCodePage]

Arguments

FileName

Specifies the name of the file to which Visual FoxPro exports data. If you do not include an extension with the file name, the default extension for the specified file type is assigned.

TYPE

Specifies the type of file to be created. The TYPE keyword is optional, but you must specify one of the following file types.

File type Description
DIF Each field from a Visual FoxPro table becomes a vector (column) and each record becomes a tuple (row) in a DIF (Data Interchange Format) file, used by VisiCalc. The new file name is assigned a .DIF extension if an extension isn't included in FileName.
MOD Use the MOD clause to export to a file in Microsoft Multiplan version 4.01 MOD format. The new file name is assigned a .MOD extension if you don't include an extension in FileName.
SYLK A Symbolic Link interchange format (used by Microsoft Multiplan) in which each field from a Visual FoxPro table becomes a column in the spreadsheet and each record becomes a row. By default, SYLK file names have no extension.
WK1 Include this option to create a Lotus 1-2-3 spreadsheet from a Visual FoxPro table. A .WK1 extension is assigned to the spreadsheet file name for use with Lotus 1-2-3 revision 2.x. Each field from the table becomes a column in the new spreadsheet, and each record in the table becomes a spreadsheet row.
WKS Include this option to create a Lotus 1-2-3 spreadsheet from a Visual FoxPro table. A .WKS extension is assigned to the spreadsheet file name for use with Lotus 1-2-3 revision 1-A. Each field from the table becomes a column in the new spreadsheet, and each record becomes a row in the spreadsheet.
WR1 Include this option to create a Lotus Symphony spreadsheet from a Visual FoxPro table. A .WR1 extension is assigned to the spreadsheet for use with Symphony version 1.01. Each field from the table becomes a column in the new spreadsheet, and each record in the table becomes a row in the spreadsheet.
WRK Include this option to create a Lotus Symphony spreadsheet from a Visual FoxPro table. A .WRK extension is assigned to the spreadsheet file name for use with Symphony version 1.10. Each field from the table becomes a column in the new spreadsheet, and each record in the table becomes a row in the spreadsheet.
XLS Include this option to create a Microsoft Excel worksheet from a Visual FoxPro table. Each field in the selected table becomes a column in the worksheet, and each table record becomes a row. An .XLS file name extension is assigned to the newly created worksheet file unless you specify a different extension.
XL5 Include this option to create a Microsoft Excel version 5.0 worksheet file from a Visual FoxPro table. Each field from the currently selected table becomes a column in the spreadsheet and each record becomes a row. An .XLS extension is assigned to the new worksheet if you do not include a file extension.

FIELDS FieldList

Specifies which fields are copied to the new file. If you omit the FIELDS clause, all fields are copied to the new file. Memo and general fields are not copied to the new file even if their names are included in the field list.

Scope

Specifies a range of records to copy to the new file. Scope Specifies a range of records to copy to the new file. Only the records that fall within the range are copied to the new file. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

For more information on scope clauses, see the Scope Clauses online topic. Commands that include Scope operate only on the table in the active work area.

The default scope for EXPORT is all records.

FOR lExpression1

Specifies that only records that satisfy the logical condition lExpression1 are copied to the new file. Using this argument allows you to filter out undesired records.

Rushmore optimizes an EXPORT ... FOR lExpression1 command if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

For more information, see SET OPTIMIZE and "Understanding Rushmore Technology" in Chapter 15, Optimizing Applications, in the Programmer's Guide.

WHILE lExpression2

Specifies a condition whereby records are copied to the new file for as long as the logical expression lExpression2 evaluates to true (.T.).

NOOPTIMIZE

Disables Rushmore optimization of EXPORT.

For more information, see SET OPTIMIZE and "Understanding Rushmore Technology" in Chapter 15, Optimizing Applications, in the Programmer's Guide.

AS nCodePage

Specifies the code page for the file EXPORT creates. Visual FoxPro copies the contents of the currently selected table, and, as it copies the data, automatically converts the data to the code page you specify for the new file. If possible, Visual FoxPro marks the newly created file with the code page you specify.

If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP( ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the file Visual FoxPro creates.

If you omit AS nCodePage, no code page conversion occurs. If possible, Visual FoxPro marks the newly created file with the code page of the table from which the data is copied.

If nCodePage is 0, no code page conversion occurs and the newly created file is not marked with a code page.

Remarks

Use EXPORT to use Visual FoxPro data in other software packages.

If the table you are exporting from is indexed, the new file is created in the indexed order.