Find out the range of a excel-sheet

Find out the range of a excel-sheet

Postby Marc Vanzegbroeck » Thu Dec 05, 2019 6:19 pm

Hi,

I have to import an excel file into a database an now I'm using the oSheet:Cells( nRow, nCol ):Value methode to read the first column to know
how many records the are, and read the fist row , how many colums to import.
Then I can use GetExcelRange()
Is there a faster way to know which row is the first empty cell, and which column is the first empty one?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Find out the range of a excel-sheet

Postby nageswaragunupudi » Thu Dec 05, 2019 6:35 pm

oRange := GetExcelRange( cExcelFile )
Automatically returns the used range.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Find out the range of a excel-sheet

Postby Marc Vanzegbroeck » Thu Dec 05, 2019 7:59 pm

Thank you,

With len( ArrTranspose( oRange:Value )) and now how many records there are, but how can I know the numbers of columns?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Find out the range of a excel-sheet

Postby nageswaragunupudi » Thu Dec 05, 2019 8:10 pm

? oRange:Rows:Count
? oRange:Columns:Count
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Find out the range of a excel-sheet

Postby Marc Vanzegbroeck » Thu Dec 05, 2019 8:14 pm

Thank you,

I just found that also
Code: Select all  Expand view
len( ArrTranspose( oRange:Value )[1])
works :D

But your suggestion is nicer :)
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Jimmy and 89 guests