Search code examples
google-sheetsgoogle-apps

Filter data in new sheet


I have a databese in "Test" and I wish to have a new sheet "Test 7 days" that will show data based on date from Col A in "Test", specificaly only last 7 days.

I can achive it with formula as below:

=FILTER(Test!A2:M39;TODAY()-Test!A2:A39<=7)

But the formula needs set range already and I wish to add more to "Test" and have it automaticly updated in "Test 7 days".

I can also create a button that will lunch the script to refresh the "Test 7 Days", but would prefer if the script would run at the beggining of each day for example.

I know basics, I know that I can get dataRange, I can copy the stuff and clear it with scripts, but not yet enough to create my own script, so any help will be appriciated. Same with explanation what is going on for me to learn.


Solution

  • You can leave the range open ended:

    =FILTER(Test!A2:M;TODAY()-Test!A2:A<=7)