title: Can't find the active or selected cell in excel using Openpyxl
body: <p>I want to use python to find what the address or coordinates of the currently active or selected cell in an excel spreadsheets currently active sheet. </p>
  
  <p>So far all I've been able to do is the latter. Perhaps I'm just using the wrong words to search. However, this is the first time in two years of writing first VBA and now Python that I haven't been able to just search and find the answer.  Even if it took me half a day.<br>
  I've crawled through the code at readthedocs (<a href="http://openpyxl.readthedocs.org/en/latest/_modules/index.html" rel="nofollow">http://openpyxl.readthedocs.org/en/latest/_modules/index.html</a>) 
  and looked through the openpyxl.cell.cell, openpyxl.worksheet.worksheet, openpyxl.worksheet.views code. The last seemed to have some promise and led me to writing the code below.  Still, no joy, and I don't seem to be able to phrase my online searches to be able to pinpoint results that talk about finding the actual active/selected cell.  Perhaps this is because openpyxl is really looking at the saved spreadsheet which might not include any data on the last cell to be selected. 
  I've tried it both in Python 3.4.3 and 2.7.11.  Using openpyxl 2.4.0. 
  Here's the code that got me the closest to my goal. I was running it in Python3.</p>
  
  <pre><code>from openpyxl.worksheet.views import Selection
  import openpyxl
  
  
  wb = openpyxl.load_workbook('example.xlsx')
  ws = wb.active
  print(wb.get_sheet_names())
  print(ws)
  print(Selection.activeCell)
  </code></pre>
  
  <p>Which gives me the below.</p>
  
  <pre><code>['Sheet1', 'Sheet2', 'Sheet3']
  &lt;Worksheet "Sheet3"&gt;
  Values must be of type &lt;class 'str'&gt;
  </code></pre>
  
  <p>I put in the first two prints just to prove to myself that I'm actually accessing the workbook/sheet.</p>
  
  <p>If I change the last line to:</p>
  
  <pre><code>print(Selection.activeCellId)
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>Values must be of type &lt;class 'int'&gt;
  </code></pre>
  
  <p>I assume this is because these are only for writing not querying.  I've toyed with the idea of writing a VBA macro and just running it from python. However, this code will be used with spreadsheets I don't control.  By people who aren't necessarily capable of fixing any problems.  I don't think I'm capable of writing something good enough to handle any problems that might crop up either. </p>
  
  <p>Any help will be greatly appreciated. </p>