使用gspread

时间:2018-07-11 05:43:52

标签: python google-sheets google-sheets-api gspread

list = [['Akbar',1,34],['lata',1,56],['sita',5,45]]

我希望将此列表插入为

enter image description here

cell_list = worksheet.range('A1:C7')

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

# Update in batch
worksheet.update_cells(cell_list)

gspread 3.0.1文档中提到了这一点,是否有直接之处?像以前的版本一样?(3.0.0)

spread_sheet.values_update(
             RANGE, 
             params={'valueInputOption': 'RAW'}, 
             body={'values': list}
         )

1 个答案:

答案 0 :(得分:0)

这会有所帮助吗?

for i in range(len(your_list)):
    l = your_list[i]
    for j in range(len(l)):
        x = l[j]
        spread_sheet.update_cell(i+1,j+1,x)