Mar*_*inK 8 google-sheets google-apps-script
我正在使用Google Apps脚本对电子表格中的数据进行加密.它工作正常,但电子表格中的方便修订历史记录使得它有点没有实际意义,因为您只需在加密之前查看版本即可.
有没有办法删除修订历史记录,或简单地阻止它们一起创建?
No. The Drive API for accessing revision history specifically does not delete entries on Google sheets.
Something to note revision history is only viewable by those with edit rights. View or comment only rights cannot see revision history.
One solution is to have users submit data to a very narrowly shared sheet via Google forms and set up a trigger to copy the non sensitive meta/aggregate data that you are leaving unencrypted to a more public sheet for access by untrusted users and scripts. the cell formula IMPORTRANGE() would also work it gets access permission from the person entering the formula and can therefore move data from a restricted spread sheet to a less restricted one without compromising the original sheet.
A second solution that is slightly more cumbersome, but closer to your ask, is to provide users and external scripts with access to a drive folder containing the sheet. With the ID of the folder scripts can then search for the sheet by name via the drive api, users use their eyes to find it by name. Your encryption script, once done encrypting, copies the spreadsheet using SpreadsheetApp.copy(name)which will copy all of the formulas, formatting, data, even scripts, but not the revision history. Pass copy() the same name as the original sheet, drive file names do not have to be unique. Use the drive api to move the new spreadsheet to the folder, it should inherit the sharing of the folder by default. Again with the drive API delete the original spreadsheet. Because all users and scripts were looking for a file named X in a specific folder ID everything is still exactly where they expect to find it, but the revision history is gone.
| 归档时间: |
|
| 查看次数: |
9784 次 |
| 最近记录: |