Auto-delete Website Content after Expiring

Jul 6, 2022

Sometimes you need to have content available on the website only for a certain period of time. For example, you publish job offers or internships and there’s a deadline for submitting a CV. Or you want to offer your visitors exclusive educational content for a limited time.

Whatever the case is, there are two ways to manage that kind of content: you can remove it from the Sheet manually after the expiration date or automate this process with the power of Google Sheets!

This blog post will show you how to automatically hide cards on your website after a specific date using =FILTER and =TODAY functions in Google Sheets.

Configuring your content expiration date

Here’s what you need to do:

  1. Open your Google Sheet and create a Date column, and fill it with dates.
Auto-delete Website Content after Expiring

Quick tip: if your content Sheet is connected to a Google Form, by default there will be a column named Timestamp that you can use instead.

2. Make a copy of your data Sheet (duplicate the tab) and remove all the data except the headers row in the duplicated Sheet.

Put this tab to the first place and name it e.g. Filtered listings.

Auto-delete Website Content after Expiring

Now it will be your new content source containing only the filtered data.

  1. Put the FILTER function to the A2 cell: =FILTER('All listings'!A2:M,'All listings'!A2:A + 7 > TODAY())
    Where 7 is the number of days after which the row will be considered expired and will be filtered out.
Auto-delete Website Content after Expiring
  1. In your spreadsheet menu go to File -> Settings -> Calculation menu, set Recalculation to On change and every hour and save settings.
Auto-delete Website Content after Expiring


Auto-delete Website Content after Expiring

As you can see, for now on website there will be only the rows (cards) added in July.

You can change the dates in 'All Listings' Sheet and the number of days in the formula to define the period of time during which the listings will be visible on website.

And, just in case, here you can find our sample Sheet.

Create a website from Google Sheets
Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.