# Automations to delete rows based on time

**URL:** <https://connect.superhuman.com/t/automations-to-delete-rows-based-on-time/28793>\
**Category:** Ask the Community\
**Created:** [February 9, 2022, 6:27pm UTC](https://connect.superhuman.com/t/automations-to-delete-rows-based-on-time/28793 "2022-02-09T18:27:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Scott\_Collier-Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_collier-weir/32/29677_2.png) [@Scott\_Collier-Weir](https://connect.superhuman.com/u/Scott_Collier-Weir)\
**Post date:** [February 9, 2022, 7:40pm UTC](https://connect.superhuman.com/t/automations-to-delete-rows-based-on-time/28793/2 "2022-02-09T19:40:25Z")

</div>

Oh for SURE! Great idea - Doc optimization is always key:

In that realm you have a couple of options depending on the kind of data you are dealing with:  
**1. Archive that data to preserve it while still speeding up your doc**

> **Options and Resources**
>
> 1. @Connor_McCormick1 's archive method  
> [How to handle large docs (Archive Docs)](https://connect.superhuman.com/t/how-to-handle-large-docs-archive-docs/25887)
> 2. My archive method  
> [How to handle large docs (Archive Docs) - #13 by Scott\_Collier-Weir](https://connect.superhuman.com/t/how-to-handle-large-docs-archive-docs/25887/13)
> 
> Both methods will allow you to archive your data but preserve it within your doc allowing you to still query that data and run reports on it.

**2. Run an automation to delete your rows**  
While there are a lot of ways to do this, I would run an automation similar to the following:

- **When** : time-based automation that runs every day in the middle of the night
- **Then** : deleteRows -

```auto
targetTable.filter(date<=(today()-days(60))

```

That should essentially locate any rows where a date is at least 60 days old and erase it \_Dates are a little silly though sometimes and I haven’t tested the exact formula, but should work.

Reach out if you need any more help!

---

_[View the full topic](https://connect.superhuman.com/t/automations-to-delete-rows-based-on-time/28793)._
