Export from Excel/CSV to DBF

HMG Samples and Enhancements

Moderator: Rathinagiri

RPC
Posts: 54
Joined: Fri Feb 10, 2017 4:12 am
Has thanked: 18 times
Been thanked: 1 time

Export from Excel/CSV to DBF

Post by RPC » Thu Feb 16, 2017 6:40 pm

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: 5025
Joined: Tue Jul 29, 2008 6:30 pm
Location: Sivakasi, India
Has thanked: 75 times
Been thanked: 83 times
Contact:

Re: Export from Excel/CSV to DBF

Post by Rathinagiri » 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Anand
Posts: 101
Joined: Tue May 24, 2016 4:36 pm
Has thanked: 11 times
Been thanked: 21 times

Re: Export from Excel/CSV to DBF

Post by Anand » 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
Image

RPC
Posts: 54
Joined: Fri Feb 10, 2017 4:12 am
Has thanked: 18 times
Been thanked: 1 time

Re: Export from Excel/CSV to DBF

Post by RPC » Fri Feb 17, 2017 6:54 pm

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: 54
Joined: Fri Feb 10, 2017 4:12 am
Has thanked: 18 times
Been thanked: 1 time

Re: Export from Excel/CSV to DBF

Post by RPC » Fri Feb 17, 2017 6:58 pm

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: 211
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 13 times
Been thanked: 4 times
Contact:

Re: Export from Excel/CSV to DBF

Post by apais » Fri Feb 17, 2017 8:12 pm

activex is your friend !

RPC
Posts: 54
Joined: Fri Feb 10, 2017 4:12 am
Has thanked: 18 times
Been thanked: 1 time

Re: Export from Excel/CSV to DBF

Post by RPC » Sat Feb 18, 2017 5:57 am

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: 211
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 13 times
Been thanked: 4 times
Contact:

Re: Export from Excel/CSV to DBF

Post by apais » Sat Feb 18, 2017 2:41 pm

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

RPC
Posts: 54
Joined: Fri Feb 10, 2017 4:12 am
Has thanked: 18 times
Been thanked: 1 time

Re: Export from Excel/CSV to DBF

Post by RPC » Sat Feb 18, 2017 2:58 pm

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: 5025
Joined: Tue Jul 29, 2008 6:30 pm
Location: Sivakasi, India
Has thanked: 75 times
Been thanked: 83 times
Contact:

Re: Export from Excel/CSV to DBF

Post by Rathinagiri » Sat Feb 18, 2017 3:04 pm

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

Who is online

Users browsing this forum: Google [Bot] and 2 guests