The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 number of rows in a col
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tschunck

Germany
13 Posts

Posted - 01/23/2024 :  05:44:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can use range notation. E.g.

range aa = [Book]Sheet!Col(X);
nrows = aa.getSize();

Best,
Chao
Go to Top of Page

tschunck

Germany
13 Posts

Posted - 01/23/2024 :  10:35:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Works great.
Thanks!
Go to Top of Page

hopkins2

USA
2 Posts

Posted - 02/26/2024 :  05:18:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page

aplotnikov

Germany
169 Posts

Posted - 02/26/2024 :  05:36:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
For example, if you're using Python

This is actually a forum dedicated to Labtalk, not Python.
Go to Top of Page

hopkins2

USA
2 Posts

Posted - 02/26/2024 :  11:47:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000