更新时间:2023-12-05 23:42:10
不幸的是,脚本所做的操作等同于您自己在单元格中编写某些内容.在工作表侧跟踪编辑堆栈,并由运行脚本的用户进行编辑.
Sadly, the operation the script does is equivalent to you writing something in a cell yourself. The edit stack is tracked on the Sheet side and the edits are made by the user running the script.
您唯一的希望就是以与打开电子表格的用户不同的用户身份运行它,但是鉴于onEdit()
触发器的性质,这可能是不可能的.请参阅触发器文档.
Your only hope would be to run it as a different user than the one that has opened the spreadsheet, but that may not be possible given the nature of onEdit()
triggers. See the trigger documentation.
我建议这样做的原因是工作表会分别跟踪每个用户的编辑.但是,即使这不是一个完美的解决方案,就像我们都编辑完全相同的单元格一样,撤消操作仍然会更改您所做的任何修改.例如,如果我将A
写入一个空单元格,然后又将B
写入同一单元格,则我按下undo,它将再次成为一个空单元格.
The reason I suggest this is that sheets tracks each users edits separately. However even this is not a perfect solution as if we both edit the exact same cell, my undo will still change whatever your edits were. E.G if I write A
into an empty cell, and you then write B
into that same cell, one I hit undo, it will be an empty cell again.