If you give meaningful names to your sheet tabs — like dates, project names, or categories — why not put them to use inside your formulas?
Say you’re entering daily data in a sheet named 2025-07-20. You want a formula that filters only that day’s data, and tomorrow, when you rename the sheet to 2025-07-21, the same formula should work without editing it. Sounds good, right?
Let’s see how to make that happen in Google Sheets — with a tiny script, a tick box to refresh the value, and a dynamic formula that uses the current sheet name as the filter criterion.
Get the Current Sheet Name Using Apps Script
We’ll start with a custom function that returns the current sheet name.
- Click Extensions > Apps Script
- Delete any placeholder code and paste this:
function SHEETNAME(dummy) {
return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
}
The dummy parameter lets the function recalculate when something changes — we’ll use that with a tick box.
- Name your project something like Current Sheet Name
- Click the floppy icon to save
Set Up a Refresh Mechanism for the Sheet Name
We’ll use one cell to refresh and another to hold the current sheet name.
- Leave row 1 empty so it doesn’t interfere with your data
- In A1, insert a checkbox (Insert > Tick box)
- In B1, enter:
=SHEETNAME(A1)
Now, every time you check or uncheck the box, B1 refreshes with the current sheet name.
Bonus Tip: Convert the Sheet Name to a Date or Number
If your tab names are dates (like 2025-07-20), use this instead:
=TO_DATE(DATEVALUE(SHEETNAME(A1)))

If they’re numbers (like 101 or 202), use:
=VALUE(SHEETNAME(A1))
Example: Use the Current Sheet Name in a Filter Formula
Here’s some sample data starting in A2:D:

Let’s say you want to filter this data based on the sheet name (which is a date). In cell F2, enter:
=FILTER(A3:D, A3:A = B1)
This filters rows where the Date (column A) matches the sheet name shown in B1.
How It Works in Practice
The idea is simple: rename the sheet, tick the box, and the formula updates automatically. You don’t need to touch the formula again — just rename the sheet as usual and click the checkbox to refresh.
Why It’s Useful
This trick is especially helpful when your workflow involves renaming or duplicating sheets regularly, because the formulas inside can adapt automatically based on the sheet name.
Here are a few examples:
- In daily logs, when you duplicate yesterday’s sheet and rename it to today’s date, the formula updates itself to pull only today’s data — no edits needed.
- In project tracking, each sheet might represent a different project. Rename the tab, and your formulas instantly adjust to match the new context.
- In user dashboards, you can create one template sheet and simply rename it for each person — the formulas will still work correctly using the current sheet name.
- And it’s not limited to just
FILTER— you can use the current sheet name as a criterion in functions likeXLOOKUP,XMATCH,COUNTIFS, and more, wherever a dynamic condition is needed.
No more hardcoding values — just rename the sheet and let the formulas handle the rest.