How to access data on different Google Spreadsheet through Google Apps Script?

Viewed 72672

I'm writing a Google Apps Script on my Google Site and am trying to use data that is provides on 2 different tabs in a Google Spreadsheet. From what I thought I understood from the documentation I could use all available methods in the SpreadsheetApp class on a Sites script by just using the openById() method.

Anyway here is what I tried to do

function doGet(e) {

    var doc = SpreadsheetApp.openById(SPREADSHEET_ID_GOES_HERE).getActiveSheet();
    SpreadsheetApp.setActiveSheet(doc.getSheetId()[1]);

    //....
}

I get the error

Cannot find method setActiveSheet(. (line 4)

I'm pulling my work off this link: Storing Data in Google Spreadsheets and also the Ui Service section listed under Building User Interfaces.

Anybody seeing what I'm doing wrong in these two lines?

4 Answers
Related