Google sheet script to remove column or row

I know i seen it in here and now can’t find it. I have a wish to have the script look at a date and if date has passed … remove row.

I’m trying to learn this script deal for my app

Just make a copy of this example. Enjoy. https://docs.google.com/spreadsheets/d/194gEy7jjDi17kBqPHxRZnfxOAIQI9bZf60rw1RggJaM/edit?usp=sharing

1 Like

ok george ty but can you tell me how it works?

Since you mentioned writing a script I assumed you knew something about scripts. Go to Tools Script. You will see the script functions there. The test_… function calls the actual delete row function. You should be able to follow the logic but if not, you will have to go online and take a look at a few Google Script tutorials.

In the end you would create a timed trigger to run nightly to remove the rows. How that is done can also be found by doing a Google search.

im just getting into it to learn and ty when i goto script tolls it is not there and ass i look to view formulas it says can only view and i then sent you a request to view

Have you considered just applying a filter that will only show entries on or after today, or are you actually looking to delete the row from the sheet?

Jeff,
i would like to be able to automatically remove a row when the dates have expired from multiple sheets
and as i was looking up about the date. i wanted to sort by date and my date is mm/dd/yyyy and i seen where you told someone to switch the date format to yyyy/dd/mm and then that worked for them so i did try what you suggested but must be i did it wrong or glide does allow that format.

here is what i have … a sheet for each member on my app so the i pull there data to a master sheet and i want to take the expired dates and have it auto remove that row.

You would need a script then to remove the dates.

As for sorting, I’ve kind of changed my stance on dates a bit.

First of all, to address you having yyyy/dd/mm…that will not work because you have day before month.
Dates structured in order of biggest value (year) to smallest value (day) will sort alphabetically as text and should still be recognized as dates by glide. You need to change from yyyy/dd/mm to yyyy/mm/dd.

Second of all, if a column in the sheet is formatted as a true date column and not a text column, then the sort in Glide should work no matter how you have your date formatted. When dates are created in Glide via the date or datetime pickers, the actual format that is saved to the sheet is in a true ISO date format 2020-02-10T22:08:19Z. That is what is stored behind the scenes within the google sheet. You are still able to modify the formatting in the sheet to get the date to look different, but google and glide will treat it as a date column. Because it’s a date column, formatting shouldn’t matter when using the glide sort. It should sort by date properly. If you are typing the date manually into the sheet, then it may or may not be recognized as a true date format. Because of that, structuring the date in yyyymmdd format will guarantee that sorting will work properly and glide will still recognize it as a date in the calendar.

A lot of my earlier suggestion were based on glide storing dates in mm/dd/yyyy format. This did not play well with international users who view dates in dd/mm/yyyy format. My suggestion of reformatting dates to yyyy/mm/dd was so a date would be recognized internationally since it’s an internationally recognized date format. Glide has since changed to storing dates in a true ISO format and that has mostly eliminated any date issues people had.

1 Like

ok ty Jeff

1 Like