google app engine - Python/gspread - how can I update multiple cells with DIFFERENT VALUES at once? -


to update range of cells, use following command.

## select range cell_list = worksheet.range('a1:a7')  cell in cell_list:     cell.value = 'o_o'  ## update in batch worksheet.update_cells(cell_list) 

for application, update entire range, trying set different value each individual cell. problem example every cell ends same value. updating each cell individually inefficient , takes way long. how can efficiently?

you can use enumerate on separate list containing different values want in cells , use index part of tuple match appropriate cells in cell_list.

cell_list = worksheet.range('a1:a7') cell_values = [1,2,3,4,5,6,7]  i, val in enumerate(cell_values):  #gives tuple of index , value     cell_list[i].value = val    #use index on cell_list , val cell_values  worksheet.update_cells(cell_list) 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -