to_google_spreadsheet 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ end
|
|
12
12
|
module GoogleSpreadsheet
|
13
13
|
class Spreadsheet
|
14
14
|
def find_or_create_worksheet_by_name(name)
|
15
|
-
worksheets.find {|ws| ws.title == name}
|
15
|
+
ws = worksheets.find {|ws| ws.title == name}
|
16
16
|
ws ||= add_worksheet(name) # create it if it doesn't exists
|
17
17
|
ws
|
18
18
|
end
|
@@ -51,9 +51,9 @@ class Array
|
|
51
51
|
def to_google_spreadsheet(worksheet, spreadsheet = nil)
|
52
52
|
session = GoogleSpreadsheet.login(*CREDENTIALS)
|
53
53
|
spreadsheet = session.spreadsheet_by_key(spreadsheet || DEFAULT_SPREADSHEET)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
ws = spreadsheet.find_or_create_worksheet_by_name(worksheet)
|
55
|
+
ws.set_header_columns(self.first)
|
56
|
+
ws.populate(self)
|
57
|
+
ws.save
|
58
58
|
end
|
59
59
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_google_spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Simon H. Eskildsen
|