1

我正在更新谷歌電子表格,它需要大約30秒來更新100個單元格。 我使用下面的答案中描述的代碼question 這是正常的嗎?這似乎非常緩慢,幾乎不可能合作。有沒有什麼選擇來加速這個過程?谷歌電子表格批量更新非常緩慢

+0

快速批量更新答案在這裏: http://stackoverflow.com/questions/8402733/what-is-the-fastest-way-to-update-a-google-spreadsheet-wit h-a-lot-of-data-throug – eddyparkinson

+1

小紙張速度更快:寫入速度受紙張大小的影響。即使只更換紙張中的一個單元格,較大的紙張也會變慢。整個電子表格的大小影響不大,但紙張大小很重要。 – eddyparkinson

+0

請在答案框中填寫答案,並在問題框中填寫問題,謝謝。 – eddyparkinson

回答

1

答案是在提供link
我改變:

private CellEntry createUpdateOperation(URL cellFeedUrl, int row, int col, String value) throws ServiceException, IOException { 
    String batchId = "R" + row + "C" + col; 
    URL entryUrl = new URL(cellFeedUrl.toString() + "/" + batchId); 
    CellEntry entry = this.service.getEntry(entryUrl, CellEntry.class); 
    entry.changeInputValueLocal(value); 
    BatchUtils.setBatchId(entry, batchId); 
    BatchUtils.setBatchOperationType(entry, BatchOperationType.UPDATE); 
    return entry; 
    } 

到:在現在+/- 20秒鐘,這是更好...

編輯

private CellEntry createUpdateOperation(URL cellFeedUrl, int row, int col, String value) throws ServiceException, IOException { 
    String batchId = "R" + row + "C" + col; 
    CellEntry batchEntry = new CellEntry(row, col, value); 
    batchEntry.setId(String.format("%s/%s", cellFeedUrl.toString(), batchId)); 
    BatchUtils.setBatchId(batchEntry, batchId); 
    BatchUtils.setBatchOperationType(batchEntry, BatchOperationType.UPDATE); 
    return batchEntry; 
    } 

300細胞

+0

問題是:他們爲什麼這麼慢? API如何如此緩慢? –