Tim Tim - 1 year ago 105
Javascript Question

Change Function from getActiveSheet() to getSheetByName("mySheet")

I am very new to Google scripts and am finding it a little confusing

The function

along with setting a timer will re-query the
but the function only writes to the first sheet.

I need to set which sheet the function writes to.

I have tried:


but does not work.


function getData() {
var queryString = Math.random();
var cellFunction = '=ImportJSON("https://sum-app.net/json?key=Mg.Clxt6A.TV1DFtPA0k8Ehpb0RDxyLH7xhU8", "/elements", "noInherit,noTruncate,Headers?' + "," + queryString + '")';


Answer Source

In your first attempt, getActiveSpreadsheet should be getActiveSpreadsheet()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download