How to make Apps Script embedded IDE suggest a list of keys of an object with its intellisense?

54 views
Skip to first unread message

Ernaldo Manuel Patrício de Sá

unread,
Mar 3, 2023, 1:40:09 PM3/3/23
to Google Apps Script Community

I'm a newbie in this technology and in the programming itself, I would really like some help on this issue. I can't make the IDE embedded in the google spreadsheet suggest me a list of the keys of an object as I put a dot in front of the name of this object.

The intention is to create an Apps Script object or function that suggests a list with the names of the pages of a google spreadsheet and that, from the selection of one of the names, returns the respective ID. This return is already effective, but the list with the object's keys, that is, the page names, does not appear as a suggestion. Below is the code that defined and loads the object with its properties:


var pagesGetId = {}; 

globalThis.pagesGetId = pagesGetId; 

function ftoLoad() { 

              var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();                                     sheets.forEach((sheet) =>

                               Object.defineProperty(this.pagesGetId, sheet.getSheetName(), { 

                                          value: sheet.getSheetId(), 

                                          writable: false

                                          enumerable: true

                                          configurable: true 

              }); 

           }); 

}; 

ftoLoad();

cwl...@gmail.com

unread,
Mar 4, 2023, 12:52:33 PM3/4/23
to Google Apps Script Community
The main problem is that the IDE (and any built-in intellisense) is running in the browser, while the info you need is still on the server. 
I doubt anything would happen, but what happens if you save the script file, and then try the dot? Probably nothing, but you never know.

Ernaldo Manuel Patrício de Sá

unread,
Mar 6, 2023, 12:14:32 PM3/6/23
to Google Apps Script Community
Thanks for answering.

Unfortunately, even if you save the script, nothing changes about the problem.
Reply all
Reply to author
Forward
0 new messages