Author |
Topic  |
|
tschunck
Germany
13 Posts |
Posted - 01/23/2024 : 05:44:50 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): Origin2024 (64-bit) 10.1.0.170 Operating System: Win10
Does anyone know how to get the number of rows in a specific [workbook]worksheet!col(X). I don´t want to activate the worksheet and then use wks.maxrows because this takes a long time when hundred of worksheets have to be opened up in order to collect data. Instead I want to get the same information without activating the window. |
|
ChaoC
USA
190 Posts |
Posted - 01/23/2024 : 10:08:43 AM
|
Hello,
You can use range notation. E.g.
range aa = [Book]Sheet!Col(X); nrows = aa.getSize();
Best, Chao |
 |
|
tschunck
Germany
13 Posts |
Posted - 01/23/2024 : 10:35:51 AM
|
Works great. Thanks! |
 |
|
hopkins2
USA
2 Posts |
Posted - 02/26/2024 : 05:18:54 AM
|
For example, if you're using Python with the openpyxl library, you can use the following code snippet:
python Copier from openpyxl import load_workbook
# Load the workbook workbook = load_workbook('your_workbook.xlsx')
# Get the specific worksheet worksheet = workbook['worksheet_name']
# Get the number of rows in column X nrows = worksheet.max_row
# Print the result print(nrows) By using this method, you can directly retrieve the number of rows in the specific column without activating the worksheet or opening each individual worksheet. This approach significantly reduces the processing time when dealing with a large number of worksheets. |
 |
|
aplotnikov
Germany
169 Posts |
Posted - 02/26/2024 : 05:36:01 AM
|
quote: For example, if you're using Python
This is actually a forum dedicated to Labtalk, not Python. |
 |
|
hopkins2
USA
2 Posts |
Posted - 02/26/2024 : 11:47:29 PM
|
quote: Originally posted by aplotnikov
quote: For example, if you're using Python
This is actually a forum dedicated to Labtalk, not Python.
Alright, I understand your point. |
 |
|
|
Topic  |
|