Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

reading an excel file

401 views
Skip to first unread message

Alessandro Barbieri

unread,
Dec 8, 2007, 5:37:03 PM12/8/07
to
Hi Folks!

I need to open an excel file. This file has 5 columns and the number of rows
is variable. Average number of records on it: 30

I want to be able to open the file, and go thru every single record and get
the value of every single column.

Any idea?

Thanks.


Jerry Siegel [TeamSybase]

unread,
Dec 8, 2007, 8:53:00 PM12/8/07
to
Export as CSV and use ImportFile?

"Alessandro Barbieri" <neva...@hotmail.com> wrote in message
news:475b1c8f@forums-1-dub...

Bruce Armstrong [TeamSybase]

unread,
Dec 8, 2007, 9:00:11 PM12/8/07
to

You could use OLE Automation, or if you declared the area where the
data is at to be a named range you could use an ODBC driver for Excel
an treat it as a database table.

On 8 Dec 2007 14:37:03 -0800, "Alessandro Barbieri"

Arthur Hefti

unread,
Dec 9, 2007, 1:42:04 AM12/9/07
to
You can do this similar to the code below. The lines starting with cells
are wrapped and belong to the same line as la_Ret =

HTH
Arthur

ll_Row = 1
myoleobject = CREATE OLEObject
li_Ret = myoleobject.ConnectToObject( sle_file.text )
IF li_Ret = 0 THEN
la_Ret = myoleobject.application.workbooks(1).worksheets(1).
cells( ll_Row, li_Col).value
DO WHILE String( la_Ret ) > ""
// do something with the data
ll_Row ++
la_Ret = myoleobject.application.workbooks(1).worksheets(1).
cells( ll_Row, li_Col ).value
LOOP
myoleobject.application.workbooks(1).Close(FALSE)
myoleobject.DisconnectObject ()
END IF
DESTROY myoleobject

0 new messages