title: How to get the current active sheet in my script?
body: <p>I'm using this code to use data in a Google Apps Script:</p>
  
  <pre><code>function getCurrentRow() {
        var currentRow = SpreadsheetApp.getActiveSheet().getActiveSelection().getRowIndex();
        return currentRow;
      }
  </code></pre>
  
  <p>But when I use other sheet than the first one (number "gid=0"), my function remains getting data from that first sheet and not from my current active sheet. Since I'm using the method <code>.getActiveSheet()</code> how can I fix that?</p>
  
  <p>PS -  I'm not calling the code from a cell. I'm using this code:
  <a href="http://opensourcehacker.com/2013/01/21/script-for-generating-google-documents-from-google-spreadsheet-data-source/" rel="noreferrer">http://opensourcehacker.com/2013/01/21/script-for-generating-google-documents-from-google-spreadsheet-data-source/</a></p>