Uncheck column of checkboxex

I have a sheet with a column of checkboxes. They can be set individually in my app but I want an “Admin” to be able to click on a “Clear All” button or switch and have them all unchecked. I tried several different things and so far unsuccessful but I am sure I am making it far more difficult than necessary (which is my standard MO) so appreciate any assists!

Jerry

I wanted the same thing as well but that functionality does not exist. I assume the checkboxes are user specific? If so, an admin cannot see the user values anyway and thus cannot clear them

Actually Robert they are check boxes that indicate which rows will be included in an alert to be sent and they are set by the admin only and could have 1 - 20 set and wanted to be able to uncheck them all to start a new day…thanks for replying!

Could you instead create a script to clear them via a time trigger every morning?

2 Likes

Somebody said scripts here. Do you need my help to set up one @pipharvester?

5 Likes

Here’s how it would work.

ezgif-1-77f1a6631725

The script for this:

function SetCheckbox() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Checkboxes');
var dataRange = sheet.getRange('A2:A');
var values = dataRange.getValues();
for (var i = 0; i < values.length; i++) {
  for (var j = 0; j < values[i].length; j++) {
if (values[i][j] == true) {
  values[i][j] = false;
}
  }
}
dataRange.setValues(values);}

What you need to change:

  • getSheetByName(‘Checkboxes’) => Change Checkboxes to your sheet name that contains the checkboxes.
  • sheet.getRange(‘A2:A’) => Change the A2:A range to your checkbox range.

Navigate to current project’s triggers and setup like I show in the video, change the time to run as you wish.

4 Likes

Well once again this forum proves to be one of the most selfless and helpful ones I have ever been part of. You are all very attentive and helpful! Thank you @Robert_Petitto and @ThinhDinh for your attention and time! Blessings to you both!

2 Likes

Blessings to you as well! Feel free to ask us whenever you need.

1 Like

Worked flawlessly!

1 Like

Lovely. Make sure you set the trigger to the time you want it to run, from then on it’s automatically run daily.

1 Like

O vídeo não estar reproduzindo!

I have uploaded a new GIF, hope it helps!

1 Like

Olá, obrigado @ThinhDinh , esse deu para eu visualizar perfeitamente. Apesar de eu não ter conseguido executar o script, deu erro aqui pra mim… O meu caso de uso seria de dentro do app acionar o checkbox, e na planilha ele estivesse atrelado a um script programado para apagar certa quantidade de linha :frowning:

Sorry I can’t speak Portuguese/Spanish. I used Google Translate, so you want a script that is programmed to erase a certain amount of line. How many lines, and how exactly do you want to trigger it?

Umas 100 linhas

1 Like

So let me summarize it, you want to trigger a checkbox from Glide, that will delete 100 lines from a sheet.

Do you want to delete them, or just clear their content? And is it the same range of lines every time (let’s say A2:A101)?

Sim, sempre o mesmo intervalo de linhas, e é excluir elas mesmo.

Is the “trigger” checkbox in the same sheet as the lines that need to be deleted, or in a different sheet?

A caixa de seleção estar na mesma planilha, na coluna “H”.

Preciso que somente as linhas venham a ser excluídas quando selecionado o checkbox de A2:A100

So a checkbox in column H will clear all the values from A2:A100 upon selection in Glide?