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 +4 -4
- data/googlesheets.gemspec +1 -1
- data/lib/googlesheets.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f5d17077c83d17f62a0c18e129e1a1b88cfe1059606b22ca012b349b6ec682
|
4
|
+
data.tar.gz: 34029b089e78a8e32cd1572971c248e5ff05d4e1e9d772754df26bfd5d6a3461
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd7ff047f1181c713132bb09b6ac4b876c681b8fc6c89d657e2d2cf0a63aa2dc3bef9f973f8f92419f89035eb290d9b2f8a47ef020ad29326532eec2a41de57c
|
7
|
+
data.tar.gz: 1bb3e0cc4fec63b073698ff2a33638d70e04a008a92a9d067d0f2c6de7d6b57a8e89caac3d9a83951cea41ace67f59eed0e1f557b83714ddf8e1e8f1ab863f82
|
data/googlesheets.gemspec
CHANGED
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
|
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.
|
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-
|
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
|