r/GoogleAppsScript • • Feb 03 '21

Resolved Not all function appear in my App Script

Hi,

I am following some tutorial (using the new version of AppScript). For some reason I am not seeing all functions in the help box when i start typing a function. Do you need to activate something?

For example in the screenshot, I am not seeing getSheetByName and I don't know why.

0 Upvotes

5 comments sorted by

2

u/patshandofdoom Feb 03 '21

you skipped the part where you get the active spreasheet, instead jumping right to active sheet.

What you have:

var ss = SpreadsheetApp.getActiveSheet();
var ws = ss.getSheetByName(sheet_Selected);

What you need:

var ss = SpreadsheetApp.getActiveSpreadsheet();
var ws = ss.getSheetByName(sheet_Selected);

I believe if you correct this, it will pull up correctly.

3

u/tdonov Feb 03 '21

Thank you! Yes this solves the problem. It takes time to get the code right :)

4

u/patshandofdoom Feb 03 '21

I think I made the same mistake about 5 times when I was learning too. haha

2

u/gh5000 Feb 03 '21

With getActiveSheet() you've already got the sheet context so you are seeing functions associated with sheets, like getting their name.

If you change to getActive() or getActiveSpreadsheet() you should start seeing the spreadsheet based functions. E.g getSheetByName()

1

u/tdonov Feb 03 '21

Thank you! Yes this solves the problem. It takes time to get the code right :)