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如何如此缓慢? –