FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Find out the range of a excel-sheet
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Find out the range of a excel-sheet
Posted: Thu Dec 05, 2019 06: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Find out the range of a excel-sheet
Posted: Thu Dec 05, 2019 06:35 PM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Find out the range of a excel-sheet
Posted: Thu Dec 05, 2019 07: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Find out the range of a excel-sheet
Posted: Thu Dec 05, 2019 08:10 PM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Find out the range of a excel-sheet
Posted: Thu Dec 05, 2019 08:14 PM
Thank you,

I just found that also
Code (fw): Select all Collapse
len( ArrTranspose( oRange:Value )[1])
works :-)

But your suggestion is nicer :-)
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion