How to clear column data from app

Hello everybody!

I need your help!

I need to clear data from a column on my table.

How can I do that ?

Solved Solved
0 14 2,506
1 ACCEPTED SOLUTION

But, itโ€™s desition needs so long time.
And few weeks ago I have make this:

I have collect my data in to Google Apps Script.
From GAS, I have make this script:

    function clearMarked() {
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var sheet = ss.getSheetByName("Animals")
      var data = sheet.getDataRange().getValues();
      var col = data[0].indexOf("ะ‘ะตะปะณั–ัั–");
      var numRows = sheet.getLastRow() + 1;
      var range = sheet.getRange(2, col+1, numRows);
      var result=range.clear();
      var date = new Date();
      Logger.log(date.toString());
      return date.toString();
    }

function doGet(request) {
  var result = clearMarked();
  
  return ContentService
   .createTextOutput(result)
   .setMimeType(ContentService.MimeType.TEXT)   
}

In appsheet I have make
button with action that call my GAS API

HYPERLINK("https://script.google.com/macros/s/ID/exec","")

Now my reset button clear marked data in few seconds.

After press this button I need just reload my app

View solution in original post

14 REPLIES 14

Easiest way - clear it in the data source.

Right now I am doing like this )

But itโ€™s not comfortable. Every time to go on data source and delete.

I want to add users, they canโ€™t do that

If your data source is Gsheet, you can do it using a script and a webhook or a timed trigger.

Agree with you. In prototype mode my users can do webhook ?

No, only when deployed.

Steve
Platinum 4
Platinum 4

You could do this with actions and a scheduled report.

I was trying to do, but couldโ€™t find. How can I do that ?

Help me pls )

Experiment a little and let us know what you come up with.

Thank you for a link. Itโ€™s helpful.

But when I am trying to use them there no effect.

I have action that I am use for marking. I am just copy this action and just change name and value to FALSE.

After that I am use type of action execute an action on a set of rows for my target table.
Make this query for select empty and market for true rows
Filter(Animals, AND([User]=Useremail(), OR(ISNOTBLANK([Mark]),[Mark]=true)))
Finaly use my action.

When I press my bulk action button nothing change. Why? And how can I found my error ?

Picture of my action

Should this:

OR(ISNOTBLANK([Mark]),[Mark]=true))

instead be this:

AND(ISNOTBLANK([Mark]),[Mark]=true))

Itโ€™s help. Working fine! Thank you very much!

But, itโ€™s desition needs so long time.
And few weeks ago I have make this:

I have collect my data in to Google Apps Script.
From GAS, I have make this script:

    function clearMarked() {
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var sheet = ss.getSheetByName("Animals")
      var data = sheet.getDataRange().getValues();
      var col = data[0].indexOf("ะ‘ะตะปะณั–ัั–");
      var numRows = sheet.getLastRow() + 1;
      var range = sheet.getRange(2, col+1, numRows);
      var result=range.clear();
      var date = new Date();
      Logger.log(date.toString());
      return date.toString();
    }

function doGet(request) {
  var result = clearMarked();
  
  return ContentService
   .createTextOutput(result)
   .setMimeType(ContentService.MimeType.TEXT)   
}

In appsheet I have make
button with action that call my GAS API

HYPERLINK("https://script.google.com/macros/s/ID/exec","")

Now my reset button clear marked data in few seconds.

After press this button I need just reload my app

Hi Sayan,

I tried your script with minor modification for my purposes, and it works fine from the Google Sheet. However, Iโ€™ve not been able to create the button on my AppSheet app, so can you please explain that part step-by-step? Iโ€™m very new to all this, so please make it simple!

Thanks and regards,
Happy Holidays!!

You need just make button on the behaiov menu and select action to open URL

Top Labels in this Space