the-generalist.com

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

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.

 

Comments  

 
0 #6 plaza.rakuten.co.jp 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 (plaza.rakuten.co.jp: http://plaza.rakuten.co.jp/zinalanzalotti/diary/)
Quote
 
 
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: https://farleyqhpkumugih.tumblr.com/post/140214659026/shoe-lifts-the-solution-to-leg-length-discrepancy?is_related_post=1
Quote
 
 
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.
Quote
 
 
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.
Quote
 
 
0 #2 youtube.com 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.
Quote
 
 
0 #1 Marius 2015-01-21 11:15
Thanks, it worked.
Started to lose hope ... :roll:
Quote
 

Add comment


Security code
Refresh

Main Menu