Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method to hide the worksheet in web interface #428

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/google_drive/worksheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: '*',
Expand Down Expand Up @@ -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
Expand Down