• Increase font size
  • Default font size
  • Decrease font size
joomla templates, wordpress themes, drupal, datalife engine, graphics, seo,

Finding the Last Row and Column in an Excel Document Using Python

E-mail Print PDF

I've had the most luck finding the last row and column in an Excel doc this way:

LastRow = sheet.UsedRange.Rows.Count

LastColumn = sheet.UsedRange.Columns.Count

This is assuming I have an object called sheet which is the worksheet I'm checking. Keep in mind that indexes start at 0 in Python, but the cell indexes in Excel start at 1. You might want to add a +1 to the LastRow and LastColumn right off the bat. Otherwise, just be careful when using them in ranges and loops. It's easy to miss the last column and row.



0 #6 2017-07-23 19:20
What's up i am kavin, its my first occasion to commenting anywhere, when i read this article i thought
i could also create comment due to this sensible post.

Feel free to surf to my web page is a foot tattoo painful (
0 #5 heel lifts 2017-05-31 13:26
I am so happy to read this. This is the kind of manual that needs to be given and not the accidental misinformation that's at the other blogs.
Appreciate your sharing this best doc.

my blog post heel lifts:
0 #4 shelf 2017-04-14 01:51
The issue in the stem of a MCQ needs to be acknowledged clearly,
utilizing straightforward vocabulary and ought to be freed from pointless
complex wording and sentence construction.
0 #3 promotion 2017-04-08 03:13
Thanks to the seamless connection between totally different Google providers, it'll additionally mean you can entry
Google Maps and provde the location of the tackle. This is one of the
best and most effective methods to find out whose cellphone number
that is.
0 #2 2016-03-24 17:31
Ce film est plutôt sympa,on y trouve des chenilles pour machines..Visionnez ces quelques images.
Les produits proposés sont vraiment top.
0 #1 Marius 2015-01-21 11:15
Thanks, it worked.
Started to lose hope ... :roll:

Add comment

Security code

Main Menu