Activar solo para nuevos usuarios

I have script which creates a new sheet in a google spreadsheet under the names of the users who fill out the form of the spreadsheet.

I would like this script to be triggered whenever a new user fills out the form associated with this spreadsheet. of course, a new user means a new E-mail address is added to the automatically generated "Username" column in the spreadsheet.

Este es mi código actualmente:

function MakeSheet() { 
var ss = SpreadsheetApp.getActiveSpreadsheet(); 
var sheet = ss.getSheetByName("default sheet"); 
var getEmail = Browser.inputBox("user Email: "); 
var s1 = ss.getSheetByName("list of users and emails"); 
var index = s1.getRange(1,1,s1.getLastRow(),1).getValues(); 
var values = s1.getRange(1,2,s1.getLastRow(),1).getValues(); 
nextIndex: for( var i in index) { if( index[i][0] == getEmail ) { var getName =   values[i][0];continue nextIndex;}}

ss.setActiveSheet(ss.getSheetByName("default sheet"));
ss.setActiveSheet(ss.getSheetByName("Copy of default sheet"));


preguntado el 31 de julio de 12 a las 15:07

Your form, in theory, should contain a Submit/Post button. The button should have a server handler which is executed when the button is clicked. You can call your code form the handler. -

1 Respuestas

The solution is to have a trigger on form submit. In the trigger function, you can check if the user is a 'new user'. By the way, I'm not sure how you get the email address - you either have to be a Google Apps user or you should be asking the email address explicitly.

Respondido 01 ago 12, 12:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.