Hello friends,
I wonder if there is any basis to let me know how many columns
and rows are occupied by data in an Excel spreadsheet.
Thanks in advance for your answers.
Best regards,
Luis Vasquez
Hola amigos,
quisiera saber si hay alguna función que me permita saber cuantas columnas
y filas hay ocupadas por datos en una hoja de Excel.
Gracias anticipadas por sus respuestas.
Muchas gracias.
LUis Vasquez.
Help with Excel.
Moderator: Rathinagiri
- luisvasquezcl
- Posts: 1263
- Joined: Thu Jul 31, 2008 3:23 am
- Location: Chile
- Contact:
Re: Help with Excel.
Hola, parece que esto necesitas. saludos.
Function excel_things()
Local oExcel, oSheet
Local nRows_op1, nRows_op2
Local nCols_op1, nCols_op2
oExcel:= CreateObject("Excel.Application")
oExcel:Visible:= .N.
oExcel:DisplayAlerts:= .N.
oExcel:Workbooks:Open("Test.xls", .Y.) // open ReadOnly
oExcel:Sheets(1):select()
oSheet:= oExcel:ActiveSheet()
nRows_op1:= oExcel:Sheets(1):UsedRange:Rows:Count()
nRows_op2:= oSheet:UsedRange:Rows:Count()
nCols_op1:= oExcel:Sheets(1):UsedRange:Columns:Count()
nCols_op2:= oSheet:UsedRange:Columns:Count()
msgInfo( str(nRows_op1)+str(nRows_op2), "rows")
msgInfo( str(nCols_op1)+str(nCols_op2), "cols")
oExcel:application:Quit() // excel off
return nil
Function excel_things()
Local oExcel, oSheet
Local nRows_op1, nRows_op2
Local nCols_op1, nCols_op2
oExcel:= CreateObject("Excel.Application")
oExcel:Visible:= .N.
oExcel:DisplayAlerts:= .N.
oExcel:Workbooks:Open("Test.xls", .Y.) // open ReadOnly
oExcel:Sheets(1):select()
oSheet:= oExcel:ActiveSheet()
nRows_op1:= oExcel:Sheets(1):UsedRange:Rows:Count()
nRows_op2:= oSheet:UsedRange:Rows:Count()
nCols_op1:= oExcel:Sheets(1):UsedRange:Columns:Count()
nCols_op2:= oSheet:UsedRange:Columns:Count()
msgInfo( str(nRows_op1)+str(nRows_op2), "rows")
msgInfo( str(nCols_op1)+str(nCols_op2), "cols")
oExcel:application:Quit() // excel off
return nil
Re: Help with Excel.
Nice function!
THX for sharing!
Best regards ,Marek
THX for sharing!
Best regards ,Marek
- luisvasquezcl
- Posts: 1263
- Joined: Thu Jul 31, 2008 3:23 am
- Location: Chile
- Contact:
Re: Help with Excel.
Excelente Millipede, muchas gracias por tu rápida respuesta, me sacaste de un buen problema ... tremendo aporte.
Saludos cordiales,
Luis Vasquez.
Saludos cordiales,
Luis Vasquez.
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Help with Excel.
Nice utility. Thanks a lot.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.