Tim*_*avk 6 html javascript blame google-sheets google-apps-script
我有一个谷歌电子表格。当我在任何单元格上单击鼠标右键时,我可以Show edit history从上下文菜单中进行选择。
之后,我可以在弹出窗口中看到编辑历史记录。
我的问题是如何通过脚本从单元格中获取这些数据?
我试图找到带有检查选项的解决方案,并在这里找到了预期的数据:
<div class="docs-blameview-authortimestamp">
<div class="docs-blameview-author">My name
</div>
<div class="docs-blameview-timestamp">May 9, 11:56 AM
</div>
</div>Run Code Online (Sandbox Code Playgroud)
任何建议如何在某些 Google 表格中导入该数据?
我正在继续寻找解决方案。
当我show edit history使用 Chrome DevTools检查此操作(到)时,我在“网络”选项卡上发现了此请求:
fetch("https://docs.google.com/spreadsheets/d/1xVrzBezPzOmZC7Vap-reuNcWXZx_0qONbZ67pBiHVkQ/blame?token=AC4w5VhQLkaKWPQT2sGl8uO8MkXyW1N7hg%3A1589033535890&includes_info_params=true", {
"headers": {
"accept": "*/*",
"accept-language": "en-US,en;q=0.9",
"content-type": "multipart/form-data; boundary=----WebKitFormBoundaryFpwmP3acru2z5xQc",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-build": "trix_2020.18-Tue_RC02",
"x-client-data": "CI62yQEIpLbJAQipncoBCNCvygEIvLDKAQjttcoBCI66ygEYmr7KAQ==",
"x-rel-id": "6a4.4ffb56e6.s",
"x-same-domain": "1"
},
"referrer": "https://docs.google.com/spreadsheets/d/1xVrzBezPzOmZC7Vap-reuNcWXZx_0qONbZ67pBiHVkQ/edit",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "------WebKitFormBoundaryFpwmP3acru2z5xQc\r\nContent-Disposition: form-data; name=\"selection\"\r\n\r\n[30710966,[null,[null,[null,\"629843311\",9,1],[[null,\"629843311\",9,10,1,2]]]]]\r\n------WebKitFormBoundaryFpwmP3acru2z5xQc\r\nContent-Disposition: form-data; name=\"clientRevision\"\r\n\r\n478\r\n------WebKitFormBoundaryFpwmP3acru2z5xQc\r\nContent-Disposition: form-data; name=\"includeDiffs\"\r\n\r\ntrue\r\n------WebKitFormBoundaryFpwmP3acru2z5xQc--\r\n",
"method": "POST",
"mode": "cors",
"credentials": "include"
});Run Code Online (Sandbox Code Playgroud)
我认识了一些参数的含义。我不确定纠正...
查询字符串参数
/* token: AC4w5VhQLkaKWPQT2sGl8uO8MkXyW1N7hg:1589033535890
AC4w5VhQLkaKWPQT2sGl8uO8MkXyW1N7hg // Probably it takes from user
1589033535890 // Timestamp of current session of current user
includes_info_params: true // I think that's what gets the user data and editing time of the cellRun Code Online (Sandbox Code Playgroud)
表格数据:
/*
selection:
[30710966, // Spreadsheet identificator (Any idea, how to get it???)
[null,[null,
[null,
"629843311", // Sheet ID in string
9, // cell's row - 1
1], // cell's column - 1
[[null,
"629843311" // Sheet ID in string
,9 // cell's row - 1
,10 // cell's row
,1 // cell's column - 1
,2 // cell's column
]]]]]
clientRevision: 478 // Edit step number (How to get it???)
includeDiffs: true // True shows last edition / false - look at previous steps
*/Run Code Online (Sandbox Code Playgroud)
我认为可以创建自定义获取并获取 blob。然后提取单元格上一版本的最后一个编辑器名称和时间戳。
不幸的是,我的技能很差。我只是在学习。有人可以帮我弄这个吗?
小智 3
也许您可以使用 Drive API 获取 clientRevisions 信息,https://developers.google.com/drive/api/v2/reference/revisions。您所说的电子表格 ID,30710966 似乎对每个电子表格都很常见。我有一个相同的字符串。我认为你已经非常接近了。对于逆向工程,我相信向每个人开放的信息应该可以通过多种方式访问。如果谷歌为此提供一些 API 那就太好了,我相信他们正在准备它,因为这是一个相对较新的功能。
| 归档时间: |
|
| 查看次数: |
2284 次 |
| 最近记录: |