Skip to content

Instantly share code, notes, and snippets.

Created May 23, 2017 07:22
Show Gist options
  • Save anonymous/88f80fd48b37916edd6cd41825e628e6 to your computer and use it in GitHub Desktop.
Save anonymous/88f80fd48b37916edd6cd41825e628e6 to your computer and use it in GitHub Desktop.
# batch clear method
# [array of ranges], spreadsheet_id, Google::Apis::SheetsV4::SheetsService
def batch_clear_ranges(arr, spr_id, srvc)
clear_request = Google::Apis::SheetsV4::BatchClearValuesRequest.new
clear_request.ranges = arr
puts "Clearing Range(s): #{arr}"
resp = srvc.batch_clear_values(spr_id, clear_request)
puts "Cleared: #{resp.to_h[:cleared_ranges]}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment