Gspread多范围更新

时间:2017-10-28 05:02:12

标签: python-3.x gspread

我想在一次通话中更新多个列。我知道它有可能:

# Select a range
cell_list = worksheet.range('C1:C7')

for cell in cell_list:
    cell.value = 'O_o'

# Update in batch
worksheet.update_cells(cell_list)

但是我想更新几列,所以范围是'C1:C7;'E1:E7';'K1:K7' 我该怎么办?

1 个答案:

答案 0 :(得分:1)

找到解决方案。

range1 = work_sheet.range('C1:C7')
range1.extend(work_sheet.range('E1:E7'))
range1.extend(work_sheet.range('K1:K7'))

for cell in range1:
        cell.value = 'O_o'

# Update in batch
worksheet.update_cells(range1)