Method: SheetsV4::GoogleExtensions::Spreadsheet#each_sheet
- Defined in:
- lib/sheets_v4/google_extensions/spreadsheet.rb
#each_sheet(ids_or_titles = sheets.map { |sheet| sheet.properties.sheet_id }) {|the| ... }
This method returns an undefined value.
Iterate over sheets in a spreadsheet
If ids_or_titles is not given or is nil, all sheets are enumerated. Otherwise,
only the sheets whose IDs or titles are in sheets are enumerated.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/sheets_v4/google_extensions/spreadsheet.rb', line 90 def each_sheet(ids_or_titles = sheets.map { |sheet| sheet.properties.sheet_id }, &block) return enum_for(:each_sheet, ids_or_titles) unless block matching_sheets = ids_or_titles.map do |id_or_title| sheet(id_or_title) || raise("Could not find sheet '#{id_or_title}'") end matching_sheets.each { |sheet| block[sheet] } self end |