From 5fd40ebaccd2410e9b7de4807a27a8eca0db80fc Mon Sep 17 00:00:00 2001 From: MohamedAsan Date: Thu, 24 Nov 2022 11:10:38 +0530 Subject: [PATCH] Add support to hide the worksheet --- lib/google_drive/worksheet.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/google_drive/worksheet.rb b/lib/google_drive/worksheet.rb index b461630f..990eea50 100644 --- a/lib/google_drive/worksheet.rb +++ b/lib/google_drive/worksheet.rb @@ -83,6 +83,9 @@ def worksheet_feed_entry # Index of the worksheet (affects tab order in web interface). attr_reader :index + # Visibility of the worksheet in Web interface. + attr_reader :hidden + # GoogleDrive::Spreadsheet which this worksheet belongs to. attr_reader :spreadsheet @@ -308,6 +311,13 @@ def index=(index) @meta_modified = true end + # Updates the visibility of the worksheet in Web interface. + # Note that update is not sent to the server until you call save(). + def hidden=(hidden) + @hidden = hidden + @meta_modified = true + end + # @api private def cells reload_cells unless @cells @@ -409,6 +419,7 @@ def save sheet_id: sheet_id, title: title, index: index, + hidden: hidden, grid_properties: {row_count: max_rows, column_count: max_cols}, }, fields: '*', @@ -668,6 +679,7 @@ def set_properties(properties) @properties = properties @title = @remote_title = properties.title @index = properties.index + @hidden = properties.hidden if properties.grid_properties.nil? @max_rows = @max_cols = 0 else