Is cell edit history accessible programmatically in Google Apps Script?

好久不见. 提交于 2021-01-29 05:54:58

问题


In have an installed trigger for onEdit and an installed trigger for onChange. I log the contents of the event object that is passed in as below

function installedOnChange(e) {
    var me = CalleeName(arguments);
    Logger.log("%s: %s", me, JSON.stringify(e));

(CalleeName is defined as

function CalleeName(a) {
    return a.callee.toString().split(" ")[1].split("(")[0].trim();
}

).

The stringification of the event contains .oldvalue and .value except in the situation where a cell is ^C copied and then ^V pasted into another cell. In that case, neither are given. For example, here we have the onEdit and onChange event data for copying into J19:

onEdit: {"authMode":"FULL","range":{"columnEnd":10,"columnStart":10,"rowEnd":19,"rowStart":19},"source":{},"triggerUid":"3504192","user":{"email":"data@blahblahblah","nickname":"data"}}

onChange: {"authMode":"FULL","changeType":"EDIT","source":{},"triggerUid":"3538611","user":{"email":"data@blahblahblah","nickname":"data"}}

As you can see, no .value and no .oldvalue.

I can equivalence the .value by evaluating e.source.getActiveCell().getValue() however, I cannot -- thus far -- establish what the previous value of the cell was, that is, what the destination cell held before the ^V paste was issued.

It occurred to me that perhaps this value might be available in the Show Edit History, a list available by right-clicking a cell in the sheet. However, I cannot find a programmatic interface to that information. Does such a thing exist? If so, how? and if not, where do I post a change request?

来源:https://stackoverflow.com/questions/61004713/is-cell-edit-history-accessible-programmatically-in-google-apps-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!