r/GoogleAppsScript • u/IyRuK • Mar 13 '20
Resolved Help with "simple" script for google sheets?
I'm trying to create script that helps me hide rows that don't contain a specific cells value
I want to be able to type in C1 and have it hide the results in a range of B3:F where the column B does not contain the text of C1.
So if i type "Fish" in C1 than only the rows containing the word fish will show up below. this is already something that working with the filter option within a range, but i want it to be a little more clean instead of having to click the filter header and changing the text and clicking ok each time.
Is this something even doable?
3
u/harpsichord_cadenza Mar 14 '20 edited Mar 14 '20
This could probably be done with the built-in QUERY function.
The query for your example would something look like
=QUERY( B3:F, "SELECT * where B = '" & C1 & "'" )
2
u/11111v11111 Mar 14 '20
The new slicers feature might be an easy way to do that: https://youtu.be/ThryOD6Ga_A
7
u/catmandx Mar 13 '20
This is absolutely doable, you would need to know how to set a onEdit trigger, how to get a values of a range, how to hide a row
After learning how to do those seperate things you should be good to go. Have fun app scripting. PM me or reply if you need further guides.