Use multiprocessing to update cells in google spreadsheet?

I am trying to calculate numbers in parallel and put them into cells in a google spreadsheet. The following is my code:

import multiprocessing, ezsheets

ss = ezsheets.Spreadsheet(spreadsheet_url)
sheet2 = ss[1]

def myfunc(inputs):
    a = sum(inputs)
    sheet2['A1']=a
    return

processes = []
for i in range(1,5):
    p = multiprocessing.Process(target=myfunc, args=[[1,2,3]])
    p.start()
    processes.append(p)
for process in processes:
    process.join()

But it does not change a cell. What am I doing wrong?

Source: Python Questions

LEAVE A COMMENT