Ready to learn about one of my favorite #GoogleSheets macros?

https://abs.twimg.com/emoji/v2/... draggable="false" alt="☕" title="Heißgetränk" aria-label="Emoji: Heißgetränk"> Settle in for a step-by-step guide to automatically resetting filters...
https://abs.twimg.com/emoji/v2/... draggable="false" alt="😡" title="Schmollendes Gesicht" aria-label="Emoji: Schmollendes Gesicht"> The problem:

I use filters on my data tables all the time, and it& #39;s annoying that there’s no way to clear all your filters in one go.

You have to manually reset each filter in turn or completely remove the filter and re-add from the menu, both of which are tedious.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="😃" title="Lächelndes Gesicht mit geöffnetem Mund" aria-label="Emoji: Lächelndes Gesicht mit geöffnetem Mund"> The solution:

Create a macro to remove and re-add the filter!

Then we can be super efficient by running it with a single menu click or, even better, with a shortcut key. Yay! https://abs.twimg.com/emoji/v2/... draggable="false" alt="🎉" title="Partyknaller" aria-label="Emoji: Partyknaller">
Step 1: From your Google Sheet, open the Script Editor window: Tools > Script editor
Step 2: Copy in the following code:

function resetFilter() (
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getDataRange();
range.getFilter().remove();
range.createFilter();
)
Step 3: Back in your Google Sheet, use the Macro Import option to import this function as a macro (Tools > Macros > Import).
Step 4: When you run it, it will remove and then re-add filters to your data range in one go.
For example, in this GIF, I have a data table with three filters applied.

Rather than remove them one by one, I simply run the macro which automatically removes and re-adds filters to my table to get me back to my unfiltered data.

It works like a charm!
You can follow @benlcollins.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: