3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/spider_rails/specific/spread_sheet.rb', line 3
def transfer
proxy = Net::HTTP.Proxy('127.0.0.1', 8087)
session = GoogleDrive.login("[email protected]", "zhuxingruo", proxy)
ws = session.spreadsheet_by_key("0AiMMAt6U-_eEdFdNbXBfUjRMTlpsdV83OE9UWTRzTUE").worksheets[0]
Card.columns.each_with_index do |c, i|
i = i + 1
ws[1, i] = c.name
end
Card.all.each_with_index do |card, i|
p "card.id:#{card.id}, i: #{i}"
if card.id >= 869
cf = card.attributes.each_with_index do |attr, j|
j = j + 1
ws[i, j] = attr[1]
end
ws.save()
ws.reload()
end
end
end
|