I would like to lock an important Docs in Google Drive, so that modification I made in fly-by-mistakes don't get saved. I am the owner of the document.
Is this possible? Or is there a feature request for it somewhere?
I would like to lock an important Docs in Google Drive, so that modification I made in fly-by-mistakes don't get saved. I am the owner of the document.
Is this possible? Or is there a feature request for it somewhere?
Publishing is one way to prevent unwanted changes. The other way (if this is a Document) is to open it in View mode.
For example, when you open a document you should see the edit mode:
https://docs.google.com/document/d/<doc_id>/edit
If you enter the URL with view
at the end then it will open for you in View-only:
https://docs.google.com/document/d/<doc_id>/view
It's not an elegant solution, but I thought I'd leave it here.
This is now offered as an option in Google Docs:
(sorry about all of the blanked out personal info - ugly).
One workaround solution that hasn't been mentioned here is using Google's "Version History" feature to name a specific version. While that won't exactly lock your file down, it will give you an easy way to restore the version you want if it ever changes.
What about creating another account that owns the document? Then you can lock it however you want. Of course to edit locked sections you'll have to switch to that account. I can't quite tell from the question if this does what you want, and I can't really tell if this thread is still active either...
You can use this solution : https://webapps.stackexchange.com/a/37095/29140.
De-select the automatic re-publish option:
Now every time you can check and dubble check before publishing.
In my case, I built a sheet of two sided business cards using Google Docs in my personal Gmail. The cards included images and print. Once I got the final edit done the way I desired, I really wanted to write protect or lock the sheet, even from the possibility of accidental changes by my own hand. From there, I used a shareable link to send the Docs from my personal Gmail to my employment Gmail. When setting up the shareable link a few sharing options are given, including the choice of "view only". I received the link to my employment Gmail and saved the sheets to my employment Gmail Google Drive. They are now as if they are "write protected" or "locked" documents in my employment Gmail account. From there I can open the Docs and print without worry. Hope this helps.
Script posted here as well.
// 1. Open your document on Google.
// 2. Go to Tools > Script Editor.
// 3. Copy the following script and save the script.
// 4. Go back to the document.
// 5. Go to the new Custom menu > Make file read only
// 6. To unlock, there will be an Unlock button on the UI (provided by Google)
//
// Inspired by https://www.labnol.org/code/read-only-google-drive-file-201011
const makeGoogleDocFileReadyOnly = () => {
const fileId = DocumentApp.getActiveDocument().getId();
UrlFetchApp.fetch(`https://www.googleapis.com/drive/v3/files/${fileId}`, {
method: 'PATCH',
contentType: 'application/json',
headers: {
Authorization: `Bearer ${ScriptApp.getOAuthToken()}`,
},
payload: JSON.stringify({
contentRestrictions: [
{
readOnly: true,
reason: 'Prevent accidental editing',
},
],
}),
});
};
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu('Custom Menu')
.addItem('Make file read only', 'makeFileReadyOnlyMenuItem')
.addToUi();
}
function makeFileReadyOnlyMenuItem() {
makeGoogleDocFileReadyOnly()
DocumentApp.getUi()
.alert('You clicked the first menu item!');
}
You can protect a range of cells or columns and rows so the warning will appear if you try to edit it. As an owner of the file you can not completely lock yourself out of acces but you won't be able to "accidentally" edit your sheet anymore.