How to get the target cell row number in the sheet with Google-apps-script
<p>I want to create a google-apps-script in google sheet.</p>

<p>First I need get the target cell row number, then continue the next step.</p>

<p>I have tried the <code>getRow()</code>and <code>getRowIndex()</code>,all of them return 0, could you tell me what's the right method...</p>

<pre><code>var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet1 = sheets[0];
var cell = sheet1.getActiveCell();
var SelectRow = cell.getRow();
Logger.log("SelectRow :" &amp; SelectRow);
</code></pre>

<hr>

<p>For Example:
<a href="https://i.stack.imgur.com/8hE0j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8hE0j.png" alt="Example"></a></p>

<p>I want to return a number 2.</p>

<p>Thank you very much in advance.</p>