Export from Excel/CSV to DBF

HMG Samples and Enhancements

Moderator: Rathinagiri

RPC
Posts: 281
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

Export from Excel/CSV to DBF

Post 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
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Export from Excel/CSV to DBF

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: Export from Excel/CSV to DBF

Post 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
Regards,

Anand

Image
RPC
Posts: 281
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

Re: Export from Excel/CSV to DBF

Post 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
RPC
Posts: 281
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

Re: Export from Excel/CSV to DBF

Post 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.
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: Export from Excel/CSV to DBF

Post by apais »

activex is your friend !
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
RPC
Posts: 281
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

Re: Export from Excel/CSV to DBF

Post 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
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: Export from Excel/CSV to DBF

Post 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
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
RPC
Posts: 281
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

Re: Export from Excel/CSV to DBF

Post 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
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Export from Excel/CSV to DBF

Post by Rathinagiri »

Can you give me a sample csv file?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply