In Google Sheets, I have a python task that goes through and copy a formula from one template and pastes it into all other sheets by specifying a key. The list of keys is about 1000 keys long and it updates pretty slowly.
Right now, I can manually chop up the list and run the code 10 times at once so I have 10 parallel instances updating all at once. But is there a way to avoid doing it manually? Here is the code
sh = self.gsheets.gc.open_by_key(source_key)
cell_list = wks.range(ranges)
sh1 = self.gsheets.gc.open_by_key(target_key)
cell_list1 = wks1.range(ranges)
for i in range(0,len(cell_list1)):
I think you probably want to check out multiprocessing, as discussed here, but I would caution that simultaneous calls to Google could be tricky. Even using the newer Google Sheets API v4 (which gspread may not avail itself of yet), there is at least one documented concurrency issue when appending data.
Having said that, Google clearly does support concurrent editing in the web UI (including by multiple users), so I'd be surprised if you couldn't figure something out (possibly with the help of gsheets, a newer Python wrapper around the newer Google API).