0

There is a script for my Google spreadsheet so that every change in a cell is indicated by a red color marker. When users with a Google account that I have shared to the spreadsheet make changes, the script is executed. However, when a user without a Google account accesses it via the share link, the script does not run. What settings do I need to choose so that the script will run that way?

I use two different scripts:

    function aktiveZeileInAndereTabelleKopieren(){
 
  // Aktives Tabellenblatt
  var sheet = SpreadsheetApp.getActiveSheet();
  
  // Aktiver Bereich und auslesen der Zeile
  var row = sheet.getActiveCell().getRow();
  
  // Tabellenblattname wo die Daten gespeichert werden sollen
  var zielTabellenName="Blocktermine";
  
  // Auf die Zieltabelle zugreifen
  var zielTabelle=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(zielTabellenName);
  
  // Letzte Zeile der Zieltabelle auslesen
  var letzteZeileVonZielTabelle=zielTabelle.getLastRow();
  
  zielTabelle.getRange((letzteZeileVonZielTabelle+1),1,1,20).setValues(sheet.getRange(row,1,1,20).getValues());
 
}

Secondly i use a simple on edit script:

function onEdit(e) {
  var color="red";  // Rot
  var range = e.range;
  range.setFontColor(color);
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Tabellenblatt1" ) { 
var r = s.getActiveCell();
if( r.getColumn() == 3 ) { 
  var nextCell = r.offset(0, 7);
  var newDate = Utilities.formatDate(new Date(), 
  "GMT+2:00", "dd.MM.YYYY HH:mm:ss");
  nextCell.setValue(newDate);
}
if( r.getColumn() == 1 ) { 
  var nextCell = r.offset(0, 9);
  var newDate1 = Utilities.formatDate(new Date(), 
  "GMT+2:00", "dd.MM.YYYY HH:mm:ss");
  nextCell.setValue(newDate1);
}
if( r.getColumn() == 2 ) { 
  var nextCell = r.offset(0, 8);
  var newDate2 = Utilities.formatDate(new Date(), 
  "GMT+2:00", "dd.MM.YYYY HH:mm:ss");
  nextCell.setValue(newDate2);
}
if( r.getColumn() == 3 ) { 
  var nextCell = r.offset(0, 7);
  var newDate3 = Utilities.formatDate(new Date(), 
  "GMT+2:00", "dd.MM.YYYY HH:mm:ss");
  nextCell.setValue(newDate3);
}
1
0

My recollection is that simple triggers run fine for anonymous users. Your script will fail if any of the target ranges are protected. Check the executions log for errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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