0
votes

I have code which succesfully render the data in spreadsheet. it is below

 //Function to insert data in the sheet on clicking the submit button
var submissionSSKey = '1BkZoHkyjfv2H_3uuvZ6ltgXCD0WdwMwirLqcJ8__oDY';  
function insertInStyleSheet(e)
{
  var app = UiApp.getActiveApplication();
  var name = e.parameter.name;
  var message = e.parameter.message;
  app.getElementById('info').setVisible(true).setStyleAttribute('color','red');

  var sheet = SpreadsheetApp.openById(submissionSSKey).getActiveSheet(); //What i have to do here ?????
  var lastRow = sheet.getLastRow();
  var targetRange = sheet.getRange(lastRow+1, 1, 1, 2).setValues([[name,message]]);
  return app;
}

Now what i have to do ?

I have opened another sheet in (Sheet2). And i have to render data in that sheet (Currently it is rendering in the same sheet (Sheet1)).

How to render it sheet2 ?

1

1 Answers

1
votes

Instead of getActive() use getSheetByName(name).