googlesheets 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d0fb6e33bdfbb0e0e82efa3be32d26166be4bf4199d894e0dd555b0c568a4f5
4
- data.tar.gz: fb113fecb311579662e9b2aa0d5cea4443c20218b0cb129741a757de242d1241
3
+ metadata.gz: d8f5d17077c83d17f62a0c18e129e1a1b88cfe1059606b22ca012b349b6ec682
4
+ data.tar.gz: 34029b089e78a8e32cd1572971c248e5ff05d4e1e9d772754df26bfd5d6a3461
5
5
  SHA512:
6
- metadata.gz: d30a91e91a3eaa552c0a84eb5f77e885d1da7fcdf6ee750f030e1b3b494a8f43a01cbc1838b8f9c4154558375b57ae985f531b37bfd4c0c1744598d7b3362c28
7
- data.tar.gz: c7143744964858819f57fc6105fb0dccd9b680b3f1c485264c3162931fd8a4455b5a0e3fc098eaa036a9ff5aff690bc3df023c40c8503cdb3d1300054046aab6
6
+ metadata.gz: bd7ff047f1181c713132bb09b6ac4b876c681b8fc6c89d657e2d2cf0a63aa2dc3bef9f973f8f92419f89035eb290d9b2f8a47ef020ad29326532eec2a41de57c
7
+ data.tar.gz: 1bb3e0cc4fec63b073698ff2a33638d70e04a008a92a9d067d0f2c6de7d6b57a8e89caac3d9a83951cea41ace67f59eed0e1f557b83714ddf8e1e8f1ab863f82
data/googlesheets.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "googlesheets"
5
- s.version = "0.2.2"
5
+ s.version = "0.2.3"
6
6
  s.author = "Steve Shreeve"
7
7
  s.email = "steve.shreeve@gmail.com"
8
8
  s.summary = "Ruby gem for Google Sheets"
data/lib/googlesheets.rb CHANGED
@@ -134,6 +134,10 @@ class GoogleSheets
134
134
  end
135
135
  end
136
136
 
137
+ def resolve_sheet(area)
138
+ area.sub(/^(#\d+)(?=!)/) {|num| sheet_name(num)}
139
+ end
140
+
137
141
  def sheet_rename(pick, name=nil)
138
142
  shid = sheet_id(pick)
139
143
  name ||= yield(sheet_name(shid)) if block_given?
@@ -164,6 +168,7 @@ class GoogleSheets
164
168
  end
165
169
 
166
170
  def sheet_filter(area, want=nil)
171
+ area = resolve_sheet(area)
167
172
  range = range(area)
168
173
  criteria = filter_criteria(want) if want
169
174
  reqs = []
@@ -174,6 +179,7 @@ class GoogleSheets
174
179
  end
175
180
 
176
181
  def sheet_format(area, pattern)
182
+ area = resolve_sheet(area)
177
183
  reqs = []
178
184
  reqs.push(repeat_cell: {
179
185
  range: range(area),
@@ -192,15 +198,19 @@ class GoogleSheets
192
198
  end
193
199
 
194
200
  def sheet_clear(area)
201
+ area = resolve_sheet(area)
202
+ area.sub!(/^(#\d+)(?=!)/) {|num| sheet_name(num)}
195
203
  api.clear_values(@ssid, area)
196
204
  end
197
205
 
198
206
  def sheet_read(area)
207
+ area = resolve_sheet(area)
208
+ area.sub!(/^(#\d+)(?=!)/) {|num| sheet_name(num)}
199
209
  api.get_spreadsheet_values(@ssid, area).values
200
210
  end
201
211
 
202
212
  def sheet_save(area, rows, log=false)
203
- area.sub!(/^(#\d+)(?=!)/) {|num| sheet_name(num)}
213
+ area = resolve_sheet(area)
204
214
  gasv = Google::Apis::SheetsV4::ValueRange.new(range: area, values: rows)
205
215
  done = api.update_spreadsheet_value(@ssid, area, gasv, value_input_option: "USER_ENTERED")
206
216
  puts "#{done.updated_cells} cells updated." if log
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: googlesheets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-16 00:00:00.000000000 Z
11
+ date: 2021-09-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem allows easy access to Google Sheets API V4.
14
14
  email: steve.shreeve@gmail.com