title: How do I find the last nonblank cell in Openpyxl?
body: <p>Openpyxl can tell me the <code>max_row</code> and <code>max_col</code>, the  "Used Range" of an Excel sheet. However, this range can include cells with no content, if they were formerly selected or altered.</p>
  
  <p>I want to know the last column and  last row  that have <em>content</em>. </p>
  
  <p>(<a href="https://contexturesblog.com/archives/2012/03/01/select-actual-used-range-in-excel-sheet/" rel="nofollow noreferrer">Discussion for VBA, here.</a>)</p>
  
  <p>For example, if <code>-</code>  here represents  blanks in Used Range and <code>_</code> means blanks outside Used Range, I want to choose the column marked with <code>b</code> and the row marked with <code>c</code>, even though Openpyxl and  would, in calculating <code>max_row</code> and <code>max_col</code>, include  the rows/columns with the dashes.</p>
  
  <pre><code>aaaaa---__
  aaaaa-b-__
  aaaaa---__
  --------__
  --c-----__
  --------__
  __________
  __________
  </code></pre>