Is setValues slower than setValue?

前端 未结 1 1409
陌清茗
陌清茗 2021-01-26 11:42

I\'ve got a Google Doc with Google Apps Script script running that multiple people contribute to. There is an onEdit trigger that is fired when people edit the shee

相关标签:
1条回答
  • 2021-01-26 11:53

    Q1: Does a setValues() take longer than a setValue()?

    A1: It's no. About this, you can see from the following experimental result.

    Q2: Does a setValues() call of a small array take less time than a setValues() of a large array?

    A2: It's yes. About this, you can see from the following experimental result.

    Q3: I had presumed one write to the sheet should take about the same amount of time regardless of size. Is there any way I can minimize this time?

    A3: When you want to reduce the process cost for putting the values more, how about using Sheets API? About this, you can see it at the figure of "A2".

    Note:

    • The rationale of above answers is Benchmark: Reading and Writing Spreadsheet using Google Apps Script.

    • As @TheMaster's comment, I also think that your issue might be resolved by LockService.

      • I think that the sample script of LockService can be seen at the stackoverflow. Ref
    0 讨论(0)
提交回复
热议问题