RDD

DbExportCsv()

Export the current work area to UTF-8 CSV

Syntax

Signature
DbExportCsv( cFile, [aFields], [bFor] ) --> nRecords

Arguments

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

DbExportCsv.prg
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" )


   RETURN

Output

See also