i am looking for solution to merge text fragements in Apps script to automate a process. I have 3 sheets (sheet_1, sheet_2,sheet_3). In each of the sheets i have 10 cells (A1:A10) to be filled by the user. After the 10th cell has been filled, the 2nd sheet (sheet_2) is to be called via the script. the procedure starts in cell A1 and ends in A10, similar to sheet_1.

function myFunction() {
var feature_1 = "sheet_1"
var feature_2 = "sheet_2"
var feature_3 = "sheet_3"
var column = 5
var feature_xx = "feature_"
for (var i = 1; i <=10; i+1) {
var feature = feature_xx.concat(i)
for (var row=1; row <=10; row+1) {
cell = SpreadSheetApp.getActive().getSheetByName(feature_1).getRange(row,column).activate();
// set rule for each cell that is activated
var rule = SpreadSheetApp.newDataValidation()
.setHelpText("Number must be between 1 and 20")

enter image description here

  • 1
    Welcome to Web Applications Stack Exchange. Your question is hard to decipher. Are you looking for a script that monitors the cells the user enters data in, and when the tenth cell Sheet1!A10 has been filled in, automatically activates cell Sheet2!A1 to let the user continue input there? Please edit the question and clearly tell what you are trying to accomplish with the procedure you describe. Jan 26 at 12:03
  • How are you prompting the user to fill in this values? Do you have a form or something?
    – DaImTo
    Jan 26 at 12:11
  • Yes that´s right. i am looking for a script that monitors the cells the user enters data. After entering the data, the next cell will be activted. When the 10th cell has been filled in, the script will automatically jump to Sheet_2!A1. There is no command prompt (GUI etc.). When opening the Spreadsheet, Sheet_1!A1 will automatically activated by the script. Jan 26 at 12:48

1 Answer 1


For moving from sheet to sheet, this should work:

// Set up variables
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet1 = ss.getSheetByName('Sheet1');
var sheet2 = ss.getSheetByName('Sheet2');

// The onEdit function runs every time there is an edit to the spreadsheet.
function onEdit(e){
  var lastCell = sheet1.getRange("A10").getValue();
  if(lastCell != ""){

For data validation, it might be easier to use the built in data validation panel. (Data > Data Validation)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.