Home / Blog / Delete Old Rows by Date

How to Automatically Delete Old Rows by Date in Google Sheets (2026)

πŸ“‹ Table of Contents

  1. Why Old Rows Pile Up (and Why It Matters)
  2. Method 1: Filter by Date and Delete Manually
  3. Method 2: QUERY Formula to Exclude Old Data
  4. Method 3: Apps Script for Date-Based Deletion
  5. Method 4: CleanSheet Automated Date Rules
  6. Method Comparison
  7. Common Use Cases
  8. FAQ

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:

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:

  1. Select your entire data range.
  2. Go to Data β†’ Create a filter.
  3. Click the filter dropdown on your date column.
  4. Select "Filter by condition" β†’ "Date is before".
  5. Enter the cutoff date (e.g., the date 30 days ago).
  6. Now only old rows are visible. Select all visible rows.
  7. Right-click β†’ "Delete selected rows".
  8. Remove the filter: Data β†’ Remove filter.
πŸ’‘ Pro Tip

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:

⚠️ Important

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:

  1. Open your spreadsheet.
  2. Go to Extensions β†’ Apps Script.
  3. 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.'
  );
}
  1. Click the Run button (▢️) and authorize the script.
  2. The script scans column A for dates older than 30 days and deletes those rows.
πŸ”§ Customize the Script

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.

⚠️ Limitations of Apps Script

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:

  1. Install CleanSheet from the Google Workspace Marketplace (free trial).
  2. Open your spreadsheet and launch CleanSheet from the Extensions menu.
  3. 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)
  4. Click "Preview" to see exactly which rows match your date condition.
  5. Click "Run" to execute the cleanup.
  6. Enable scheduled auto-run (every 1h, 6h, 12h, or 24h) to keep your sheet clean automatically.
✨ Why CleanSheet Stands Out

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 Free

Method 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

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().

Related Articles