by nageswaragunupudi » Wed Apr 26, 2023 7:05 am
Please try this:
- Code: Select all Expand view
function dbf2xlsx( cDbf )
local oExcel := ExcelObj()
local oBook, cCsv, cXls
DEFAULT cDbf := "CUSTOMER"
cDbf := TrueName( cFileSetExt( cDbf, "dbf" ) )
cCsv := cFileSetExt( cDbf, "csv" )
cXls := cFileSetExt( cDbf, "xlsx" )
FERASE( cCsv )
FERASE( cXls )
USE ( cDbf ) SHARED
COPY TO ( cCsv ) DELIMITED
oBook := oExcel:WorkBooks:Open( cCsv )
oBook:SaveAs( cXls, 51 )
FErase( cCsv )
oExcel:Visible := .t.
return nil
Regards
G. N. Rao.
Hyderabad, India