Concealing Script-Linked Images When Hiding Rows in Google Sheets

I am seeking a way to automatically hide an image in Google Sheets when its corresponding row is concealed. This image serves as an interactive button connected to a script, so using traditional methods like the IMAGE() function or embedding it within a cell isn’t a viable option. As a result, even when I hide the rows, the image remains visible. Has anyone discovered a reliable workaround to ensure that such images are hidden when their rows are not displayed?

I have tackled this issue while working on an interactive dashboard in Google Sheets. My approach involved using a time-triggered script that periodically checks the visibility of rows and accordingly adjusts the placement of the image. Instead of relying solely on an onEdit trigger, the timer trigger provided more consistency, especially when multiple rows were hidden at the same time. I combined this with image property adjustments to make the image appear less intrusive when its row was not visible. Although not perfect, this method minimized issues and provided a more reliable user experience.

I have experimented with a similar problem using Google Apps Script. My solution involves setting up an onEdit trigger that checks if a row has been hidden. Once the script detects a hidden row, it moves the attached image off the active grid so it is no longer visible to users. This method isn’t perfect as the image still exists in the document, but it effectively removes it from view. Although it requires maintenance if you modify the sheet significantly, it has proven reliable for my use cases and offers a straightforward workaround.

I have experimented with similar challenges and found that while there isn’t a built-in feature, workarounds exist via Apps Script. In my case, I wrote a custom function triggered on edit that checks if a row is hidden. If it is, the script adjusts the image properties by moving or resizing it so that it isn’t distracting on the interface. Although this solution doesn’t completely remove the image object, it effectively hides it from view without device-specific hacks. This method has worked reasonably well in my setup, but it does require a bit of maintenance if sheet structures change.

i ended up using onEdit to detect if a row was hidden then shifting the imge offscreen. not ideal but works for now. its a kludg solution and may need tweaks, but it’s my best workaround so far.