Syntax
DbExportCsv( cFile, [aFields], [bFor] ) --> nRecordsArguments
cFile
Destination CSV file. aFields Optional field list. bFor Optional filter block.
Return value
The number of records written.
Description
DbExportCsv() writes the current work area as UTF-8 CSV with a BOM, semicolon separators and a header row containing field names.
Notes
The current work area remains open.
Example
PROCEDURE Main()
DbCreate( "csv_demo.dbf", { { "NAME", "C", 12, 0 } } )
DbUseArea( .T., , "csv_demo.dbf", "People" )
DbAppend()
FieldPut( 1, "Anna" )
DbCommit()
QOut( "Exported records: " + LTrim( Str( DbExportCsv( "people.csv" ) ) ) )
DbCloseArea()
FErase( "csv_demo.dbf" )
FErase( "people.csv" )
RETURNOutput