Page 1 of 5

Export from Excel/CSV to DBF

Posted: Thu Feb 16, 2017 6:40 pm
by RPC
Hi
Does anyone have code to export from excel or CSV format to DBF.
I found some discussion on this at one thread - viewtopic.php?f=6&t=3984 - when I tried to compile it

I get error "Error BASE/1132 Bound error: array access" ...
Called from LOAD_XLS(174)

Has anyone been able to compile it successfully ?

Alternatively I tried to use APPEND FROM command(after exporting excel file to *.CSV file) but it requires date in yyyymmdd format whereas my date is in dd/mm/yyyy format.

Anyone please advice.

Thanks

Re: Export from Excel/CSV to DBF

Posted: Thu Feb 16, 2017 7:24 pm
by Rathinagiri
I am sure you can use https://vivaclipper.wordpress.com/tag/hb_atokens/ hb_atokens function to import text into a two dimensional array of data. Then you can do whatever you want with that data. That includes saving in a dbf with an iterated loop.

Re: Export from Excel/CSV to DBF

Posted: Fri Feb 17, 2017 10:02 am
by Anand
Hi RPC,

IMHO, the easiest and fastest way is to format date in the xls as yyyymmdd and export to csv and append from csv, if it is one time job.

Regards,

Anand

Re: Export from Excel/CSV to DBF

Posted: Fri Feb 17, 2017 6:54 pm
by RPC
Rathinagiri wrote: Thu Feb 16, 2017 7:24 pm I am sure you can use https://vivaclipper.wordpress.com/tag/hb_atokens/ hb_atokens function to import text into a two dimensional array of data. Then you can do whatever you want with that data. That includes saving in a dbf with an iterated loop.
Thanks Rathinagiri, I will try that. :D

Re: Export from Excel/CSV to DBF

Posted: Fri Feb 17, 2017 6:58 pm
by RPC
Anand wrote: Fri Feb 17, 2017 10:02 am Hi RPC,

IMHO, the easiest and fastest way is to format date in the xls as yyyymmdd and export to csv and append from csv, if it is one time job.

Regards,

Anand
Anand, I need to repeatedly convert excel file to dbf file, so everytime I will have to change date format in excel file.
Thanks for your suggestion though.

Re: Export from Excel/CSV to DBF

Posted: Fri Feb 17, 2017 8:12 pm
by apais
activex is your friend !

Re: Export from Excel/CSV to DBF

Posted: Sat Feb 18, 2017 5:57 am
by RPC
apais wrote: Fri Feb 17, 2017 8:12 pm activex is your friend !
Can you elaborate please :?:
An illustration/sample will help a lot. :)
Thanks

Re: Export from Excel/CSV to DBF

Posted: Sat Feb 18, 2017 2:41 pm
by apais
wiht OLE you can open book and modify/format date columns and export it to cvs.
for the code... you will have to maxro record the actions and translate VB code to harnour`s
it's no easy but is doable

HTH
Angel

Re: Export from Excel/CSV to DBF

Posted: Sat Feb 18, 2017 2:58 pm
by RPC
Excel can have date format in yyyy-mm-dd but I require date in yyyymmdd without separators.
I don't know how can that be achieved.
Thanks for your help though

Re: Export from Excel/CSV to DBF

Posted: Sat Feb 18, 2017 3:04 pm
by Rathinagiri
Can you give me a sample csv file?