mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-03 19:43:04 +08:00
[scripts] Batch upload each row
Makes the script like 4x faster.
This commit is contained in:
parent
00e1df8491
commit
2095f0907e
1 changed files with 6 additions and 4 deletions
|
@ -45,12 +45,14 @@ def update_spreadsheet(datadir):
|
|||
print row
|
||||
|
||||
# TODO: might want to use the batch upload api in order to not run into rate-limits
|
||||
for i, row in enumerate(new_data):
|
||||
for i, new_row in enumerate(new_data):
|
||||
row_num = i+2
|
||||
for j, val in enumerate(row):
|
||||
existing_row = worksheet.range('A{row_num}:C{row_num}'.format(row_num=row_num))
|
||||
for j, cell in enumerate(existing_row):
|
||||
col_num = j+1
|
||||
print "updating cell {row_num}:{col_num} with {val}".format(row_num=row_num, col_num=col_num, val=val)
|
||||
worksheet.update_cell(row_num, col_num, val)
|
||||
cell.value = new_row[j]
|
||||
print "updating cell {row_num}:{col_num} with {val}".format(row_num=row_num, col_num=col_num, val=cell.value)
|
||||
worksheet.update_cells(existing_row)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Reference in a new issue