π Table of Contents
Every spreadsheet grows over time. Orders from last quarter, form responses from months ago, expired coupon codes, old log entries β they all pile up and make your Google Sheets slower, harder to navigate, and cluttered with irrelevant data.
In this guide, you'll learn 4 proven methods to automatically delete old rows based on date β from quick manual filters to fully automated solutions that purge expired data on a schedule.
Why Old Rows Pile Up (and Why It Matters)
Data accumulation is natural in any spreadsheet workflow. But keeping outdated rows has real consequences:
- Slow performance: Google Sheets starts lagging noticeably around 50,000+ rows. Each unnecessary row consumes memory and processing power.
- Inaccurate reports: Pivot tables, charts, and
SUMIFformulas may include old data unless you constantly adjust ranges. - Visual clutter: Scrolling through hundreds of irrelevant rows wastes time and makes finding current data harder.
- Export issues: When exporting to CSV or connecting to dashboards, stale rows inflate file sizes and skew analytics.
- Collaboration friction: Team members waste time scrolling past outdated entries and may accidentally edit old records.
Method 1: Filter by Date and Delete Manually
The simplest approach β filter your sheet to show only old rows, then select and delete them.
Steps:
- Select your entire data range.
- Go to Data β Create a filter.
- Click the filter dropdown on your date column.
- Select "Filter by condition" β "Date is before".
- Enter the cutoff date (e.g., the date 30 days ago).
- Now only old rows are visible. Select all visible rows.
- Right-click β "Delete selected rows".
- Remove the filter: Data β Remove filter.
Before deleting, copy the old rows to an "Archive" tab first. This gives you a backup in case you need the historical data later. Select the filtered rows, press Ctrl+C, switch to the archive tab, and paste with Ctrl+V.
Best for: One-time cleanups on small to medium sheets.
Limitation: You have to manually calculate the cutoff date and repeat the process every time. No automation.
Method 2: QUERY Formula to Exclude Old Data
Instead of deleting rows, use Google Sheets' powerful QUERY function to create a filtered view that automatically excludes old data.
Formula:
=QUERY(Sheet1!A:E, "SELECT * WHERE A > date '"&TEXT(TODAY()-30,"yyyy-mm-dd")&"'", 1)
This formula pulls all rows from Sheet1 (columns A through E) where the date in column A is within the last 30 days. Place it in a new tab to create a live "clean" view of your data.
Customization Examples:
- Last 7 days: Change
TODAY()-30toTODAY()-7. - Last 90 days: Change
TODAY()-30toTODAY()-90. - Specific date: Replace the
TODAY()expression with a hardcoded date likedate '2026-01-01'.
The QUERY method doesn't actually delete old rows β it creates a separate filtered view. The original data remains intact. This is useful for reporting but won't improve sheet performance since the source data keeps growing.
Best for: Creating clean reporting views without touching the source data.
Limitation: Doesn't actually remove old rows. Source sheet continues to grow and slow down.
Method 3: Apps Script for Date-Based Deletion
For a technical solution that actually removes old rows, use a custom Google Apps Script.
Steps:
- Open your spreadsheet.
- Go to Extensions β Apps Script.
- Paste the following script:
function deleteOldRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
var cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - 30); // 30 days ago
var rowsDeleted = 0;
// Loop from bottom to top to avoid index shifting
for (var i = data.length - 1; i >= 1; i--) {
var cellDate = new Date(data[i][0]); // Column A = date column
if (cellDate instanceof Date && !isNaN(cellDate) && cellDate < cutoffDate) {
sheet.deleteRow(i + 1);
rowsDeleted++;
}
}
SpreadsheetApp.getUi().alert(
'Done! Deleted ' + rowsDeleted + ' rows older than 30 days.'
);
}
- Click the Run button (βΆοΈ) and authorize the script.
- The script scans column A for dates older than 30 days and deletes those rows.
Change data[i][0] to a different column index if your dates aren't in column A. For example, data[i][3] targets column D. Change the 30 in setDate to your desired number of days.
This script has no preview β rows are deleted immediately and permanently. It can time out on sheets with 50,000+ rows. Setting up scheduled triggers requires additional configuration in the Apps Script dashboard. There's also no undo after running.
Best for: Technical users who need periodic date-based cleanup.
Limitation: Requires coding knowledge, no preview, no undo, can time out on very large sheets.
Method 4: CleanSheet Automated Date Rules (Easiest)
For a no-code, fully automated solution, CleanSheet lets you create date-based cleanup rules that run automatically on a schedule.
Steps:
- Install CleanSheet from the Google Workspace Marketplace (free trial).
- Open your spreadsheet and launch CleanSheet from the Extensions menu.
- Create a new rule:
- Select your sheet and date column
- Set condition to "Date is before" and enter your cutoff
- Choose action: "Delete" or "Move to Tab" (for archiving)
- Click "Preview" to see exactly which rows match your date condition.
- Click "Run" to execute the cleanup.
- Enable scheduled auto-run (every 1h, 6h, 12h, or 24h) to keep your sheet clean automatically.
CleanSheet combines the power of date-based filtering with visual preview, scheduled automation, and a full run log. You can see exactly which rows will be affected before any action is taken β no surprises, no data loss. It even works when your computer is off, running in the background on Google's servers.
Best for: Anyone who wants automated, scheduled date-based cleanup without coding.
Advantage: Preview before deleting, scheduled auto-run, full run log, archive option, no coding required.
ποΈ Automate Date-Based Row Cleanup
Install CleanSheet and set up rules to automatically delete or archive rows older than any number of days. Free 2-day trial, no credit card required.
Install CleanSheet FreeMethod Comparison
| Method | Difficulty | Auto-Schedule | Preview | Deletes Data |
|---|---|---|---|---|
| Filter & Delete | Easy | β | β | β |
| QUERY Formula | Medium | β (live) | β | β |
| Apps Script | Hard | β οΈ Manual | β | β |
| CleanSheet | Easy | β | β | β |
Common Use Cases for Date-Based Row Deletion
- E-commerce order logs: Delete shipped orders older than 90 days to keep your active orders sheet fast.
- Form responses: Auto-purge Google Form responses older than 30 days after they've been processed.
- Support tickets: Remove resolved tickets older than 2 weeks from your active board.
- Event RSVPs: Clean up past event registrations automatically after the event date.
- Inventory tracking: Delete expired product entries or old stock movement logs.
- Marketing campaigns: Remove completed campaign rows after their end date passes.
Frequently Asked Questions
How do I delete rows older than 30 days in Google Sheets?
The fastest way is to use CleanSheet. Create a rule with a date condition (e.g., "Column A date is before 30 days ago") and set the action to "Delete". You can preview affected rows first, then run the rule. Enable the scheduler to auto-clean daily or hourly.
Can I automatically delete expired rows on a schedule?
Yes! CleanSheet supports scheduled auto-run every 1, 6, 12, or 24 hours. Set up a date-based delete rule and enable the scheduler β old rows are cleaned automatically even when your computer is off. For Apps Script, you can set up time-based triggers, but this requires additional coding.
Will deleting rows by date affect my formulas?
Deleting rows shifts cell references in formulas. Use CleanSheet's preview feature to see exactly which rows will be affected before running the rule. For critical formulas that reference historical data, consider moving rows to an archive tab instead of deleting them β CleanSheet supports both actions.
What if my dates are in different formats?
Google Sheets stores dates as numbers internally, regardless of display format. All methods in this guide work with Google Sheets' native date values. If your dates are stored as text strings (e.g., "July 27, 2026"), you'll need to convert them to proper date values first using =DATEVALUE().