Google-sheets – Enable grouping and ungrouping of rows in a locked worksheet (Google Sheets)

google sheets

I need to share a spreadsheet with some locked cells, but it is necessary that the user can use the grouping and ungrouping functions of rows. Within the pooled range there are locked and unlocked cells.

The user must be able to view all the cells in the grouped range (cells locked and unlocked for editing).

In Excel I would use the following macro:

Private Sub Workbook_Open()

  With Plan1

    .Protect Password:="123", UserInterfaceOnly:=True

    .EnableOutlining = True

  End With

End Sub

Can anyone tell me if there is equivalent function in Google Sheets?

enter image description here

Best Answer

On Google Sheets, instead of VBA there is Google Apps Script but Google Sheets range protection doesn't include "UserInterfaceOnly" and "EnableOutlining" equivalents, by the other hand the edit privilege of protected sheets/ranges is handled by user email address rather than passwords.