FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help needed to convert excel file into .DBF file
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Help needed to convert excel file into .DBF file
Posted: Sat Dec 06, 2008 02:54 AM

Hi

Can anybody help me on the subject.

Thanks

  • Ramesh Babu P
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Help needed to convert excel file into .DBF file
Posted: Sat Dec 06, 2008 03:31 AM

RAMESHBABU:

Your better alternative is Ole

Please take a look to Jeff Barnes Tips & Tricks

http://www.fivewin.info/html/tips___tri ... .php?id=46

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Help needed to convert excel file into .DBF file
Posted: Sat Dec 06, 2008 11:39 AM
#define xlDBF3 8


FUNCTION MAIN()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL oWorkBook, oSheet

    oWorkbook = oExcel:WorkBooks:Open( "E:\XHARBOUR\MYTEST.XLS" )

    oSheet = oExcel:ActiveSheet

    oSheet:SaveAs( "E:\XHARBOUR\MYTEST.DBF", xlDBF3 )

    oWorkBook:Close( .F. )

    oExcel:Quit()

    RETURN NIL


EMG
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Help needed to convert excel file into .DBF file
Posted: Sat Dec 06, 2008 03:43 PM

Hello Mr.Enrico,

Thanks you. As usually, you have helped me this time too.

Regards,

  • Ramesh Babu P
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: Help needed to convert excel file into .DBF file
Posted: Wed Jan 07, 2009 06:48 AM

Hello Mr.Enrico and Friends

When I tried to save the Excel file as .DBF file, I am getting the data column as a character type field in the
target .DBF file.

Can you please give any solution to this problem.

Thanks

  • Ramesh Babu P
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Help needed to convert excel file into .DBF file
Posted: Wed Jan 07, 2009 07:41 AM
RAMESHBABU wrote:
When I tried to save the Excel file as .DBF file, I am getting the data column as a character type field in the
target .DBF file.


Dear Ramesh,

Please check whether the Data in the excel sheet is Character or not. I mean a numeric figure is entered as character in any of the rows of a particular column.

For Eg: '1234' instead of 1234 (Press F2 Key in that particular cell)

I believe that if the data in the Excel column is text type then Target .DBF is created with Character Field Type

Regards

Anser
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Re: Help needed to convert excel file into .DBF file
Posted: Wed Jan 07, 2009 07:48 AM
Ramesh,

it's no good idea to save an Excel file as dbf file.
I tried this many times without success.

Excel is doing a lot of nonsense like

    column types are changed from numeric to character
    sometimes columns are completely ignored
    the length of fields are mostly wrong
    the maximum of rows to be exported is limited
    [/list:u]

    It's the better way to read the cell values from Excel and write them into a dbf.

    Just my 2 cents,
    Detlef
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Help needed to convert excel file into .DBF file
Posted: Wed Jan 07, 2009 08:13 AM
column types are changed from numeric to character
sometimes columns are completely ignored
the length of fields are mostly wrong
the maximum of rows to be exported is limited

It's the better way to read the cell values from Excel and write them into a dbf.


I agree with this

Regards

Anser
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: Help needed to convert excel file into .DBF file
Posted: Wed Jan 07, 2009 08:46 AM

Hi Mr.Detlef and Mr.Anser

Thanks for your attention.

Even I too faced the similar problems you have mentioned.
I too agree with your conclusion.

Thanks

  • Ramesh Babu P
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Help needed to convert excel file into .DBF file
Posted: Wed Jan 07, 2009 09:45 AM
Detlef Hoefner wrote:
it's no good idea to save an Excel file as dbf file.


Not to mention it's a feature that will be removed from future version of Excel.
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Help needed to convert excel file into .DBF file
Posted: Wed Jan 07, 2009 12:58 PM

there is an xbrowse sample

Best Regards, Saludos



Falconi Silvio

Continue the discussion