Page 1 of 1

Importing data

Posted: Wed Jun 23, 2010 8:31 am
by skiman
Hi,

On a regular base I get datafiles from new customers to import and convert their data to use in my application. Normally they deliver XLS files.

I always convert them manually, I add the fieldnames in the first row, and I export to DBF. I was wondering if someone had a tool to do this?

Re: Importing data

Posted: Wed Jun 23, 2010 9:29 am
by RDalzell
Hi Chris,

I have used several converters from the below company, they are inexpensive and offer a trial for your review:

http://www.whitetown.com/xls2dbf/

Rick

Re: Importing data

Posted: Wed Jun 23, 2010 4:28 pm
by rdonnay
Why don't you use DC_Excel2WorkArea() ?

Re: Importing data

Posted: Wed Jun 23, 2010 7:56 pm
by GeneB
Can you provide an example of it's use? I can't find any documentation for DC_Excel2WorkArea()
I updated in April. Has it been added since?

GeneB

Re: Importing data

Posted: Thu Jun 24, 2010 1:48 am
by skiman
Hi,

I will check the possibilities of it. The structure of these XLS files is always different.

Re: Importing data

Posted: Fri Jun 25, 2010 6:57 am
by rdonnay
For a sample, look in \exp19\samples\excel.

Re: Importing data

Posted: Fri Jun 25, 2010 9:19 am
by Auge_Ohr
skiman wrote:I always convert them manually, I add the fieldnames in the first row, and I export to DBF. I was wondering if someone had a tool to do this?
rdonnay wrote:DC_Excel2WorkArea() ... For a sample, look in \exp19\samples\excel.
i do find DC_Array2Excel() but not DC_Excel2WorkArea() ?

anyway, both are using Excel as activeX so the "Trick" is

Code: Select all

// select Data in Sheed
         oWorkBook:workSheets(1):usedRange:Select
// Row and Col
         numRows    := oWorkBook:workSheets(1):usedRange:Rows:Count
         numColumns := oWorkBook:workSheets(1):usedRange:Columns:Count
// build a empty Array with Row/Col Dimension
         FOR i := 1 TO numRows
            AADD(aExcel,ARRAY(numColumns))
         NEXT
// same as Get_Excel_Column_ID
         cEnde := ZAHL2CHR(numColumns)
// assing hole "marked" Sheed to Array
         aExcel := oSheet:range( "A1:"+cEnde+LTRIM(STR(numRows)) ):value
now you can modify Array aExcel as you like and you do not need a temporary DBF to import.