title: How to access the current table in Numbers?
body: <p>How do I access the current table in Numbers using <code>py-appscript</code>?</p>
  <hr />
  <p>For posterity, the program I created using this information clears all the cells of the current table and returns the selection to cell <code>A1</code>. I turned it into a Service using a python Run Shell Script in Automator and attached it to Numbers.</p>
  <pre><code> from appscript import *
  
   Numbers = app('Numbers')
   current_table = None
   for sheet in Numbers.documents.first.sheets():
        for table in sheet.tables():
             if table.selection_range():
                  current_table = table
  
   if current_table:
        for cell in current_table.cells():
             cell.value.set('')
  
        current_table.selection_range.set(to=current_table.ranges[u'A1'])
  </code></pre>
  <p>It was used to clear large tables of numbers that I used for temporary calculations.</p>