mercredi 23 septembre 2020

How to check a checkbox in Google Apps Script?

So I'm trying to make a sign-in/sign-up form on Google Sheets, and I have two checkboxes, one that says login, and one with sign up. In my apps script, I'm trying to make it so that only one of them can be checked. This is my code, and it's not working. Help?

function signupLogin() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  if (sheet.getRange('A13').isChecked() === 'TRUE') {
    sheet.getRange('B13').setValue('FALSE');
  } else {
    sheet.getRange('B13').setValue('TRUE'); 
  }
}

The code will always make the second checkbox ticked, even if the first one is ticked.




Aucun commentaire:

Enregistrer un commentaire