r/GoogleAppsScript • • May 04 '21

Question Help migrating from Excel to Sheets... specifically need help automatically hiding/unhiding rows.

Hi folks!

I was told this is the subreddit for my problem/questions.

First, yes I have googled this. I have looked at quite a few examples but for some reason it just isn't clicking for me with the Google App Scripts coding when coming from VBA.

I have a workbook in Excel that I built. I'm proud of it. Taught myself some basic VBA to get it to do things I needed done. We have a restaurant and I am building out our catering division more. I needed to streamline processes to make things more automated and such. I built this workbook that calculates information, outputs catering quotes, outputs catering contracts, etc. I have recently realized how damn powerful Google Sheets is as well as Google App Scripts. I want to move this all out of Excel and into the Google-sphere.

I am struggling with one specific piece right now. How to hide and unhide rows in a sheet based on whether the information in a specific cell in the row is populated.

At the suggestion of another user, I threw together a small example Google Sheet for people to reference and maybe help me.

The sheet is here.

Also, I had created a small video of a screen recording to show what my excel spreadsheet does so you can see more clearly what I want to do when I move this excel workbook over to google sheets.

This is the video. It's only like 45 seconds.

In my sample Google Sheet, I want to enter quantities into the "Amount" column of the 'Calc' sheet. You will see when you do that it auto-populates that info over into the 'Output' sheet.

I used the 'Output' sheet to extract a PDF Catering Quote for the customer, so I only want to see the rows that have quantities in them and want rows of items with 0 quantities to remain hidden unless a quantity greater than 0.5 is entered for that item in the 'Calc' sheet.

I kind of show that process in the Excel workbook in the video I linked above as well.

Also, not sure if you are comfortable with VBA, but here is my code for the 'Output' sheet in Excel. It's pretty logical to follow, I think. Learned VBA on the fly to get that going. I have a lot of other spots in my Excel workbook that utilize the hiding/unhiding of rows but I feel like if I can get it nailed down in this one sheet I can figure it out with the rest of them, hopefully.

Thanks for any ideas and help!

6 Upvotes

Duplicates