[Q]Importing Data from Excel files via ODBC Mechanism

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Q]Importing Data from Excel files via ODBC Mechanism

Günther Schmidt
Hi all,

I need to import data from Excel files into Dolphin, and I think this
should be possible through an ODBC mechanism.

Can anybody point me in the right direction?

Günther


Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Excel files via ODBC Mechanism

Matias Maretto
Gunther: I don't know if it's the right direction, but I use ODBC to
get data from my SQL server. I use this:

aConection  := DBConnection new open.
aResultArray := (aConection exec: 'select * from myTable') results
asArray.

This let you choose an ODBC data Source.
Each Object of aResultArray is a ODBRow.
Good Luck.


Reply | Threaded
Open this post in threaded view
|

Re: [Q]Importing Data from Excel files via ODBC Mechanism

Chris Uppal-3
In reply to this post by Günther Schmidt
Günther Schmidt wrote:

> I need to import data from Excel files into Dolphin, and I think this
> should be possible through an ODBC mechanism.

I'm not sure how reliable that is, there seem to be a number of problems and
caveats about the ODBC driver for Excel.

Anyway, one way to do it is via a DSN-less connection:  Eg:

    file := 'C:\Temp\TestData.xls'.
    cs := 'DRIVER={Microsoft Excel Driver (*.xls)};DBQ=' , file.
    conn := (DBConnection new)
                    connectString: cs;
                    open;
                    yourself.

You can then try:

    conn query: 'SELECT * FROM [Sheet1$]'

Don't forget to:

        conn close.

There are a number of options you can set in the connect-string, evaluate

    conn connectString.

to see what the driver adds for you.  Also see:

http://msdn.microsoft.com/library/en-us/odbc/htm/odbcjetmicrosoft_excel_driver_programming_considerations.asp
for more information.  It's worth searching the MS knowledge base for
    Microsoft Excel Driver
too.

    -- chris