How to get the target cell row number in the sheet with Google-apps-script -


i want create google-apps-script in google sheet.

first need target cell row number, continue next step.

i have tried getrow()and getrowindex(),all of them return 0, tell me what's right method...

var ss = spreadsheetapp.getactivespreadsheet(); var sheets = ss.getsheets(); var sheet1 = sheets[0]; var cell = sheet1.getactivecell(); var selectrow = cell.getrow(); logger.log("selectrow :" & selectrow); 

for example: example

i want return number 2.

thank in advance.

the problem logger.log("selectrow :" & selectrow);. use + instead of & string concatenation , variable displayed properly.

use:

logger.log("selectrow :" + selectrow);

or this:

logger.log("selectrow : %s", selectrow);


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -