28

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?

4
  • If you are the owner, how would you lock yourself from the doc?
    – Jacob Jan
    Commented Jan 3, 2013 at 11:44
  • 5
    How about exporting the document as a PDF, which you save to your Google Drive? Commented Jan 3, 2013 at 13:03
  • 1
    @JacobJanTuinstra If I am the owner, a doc locked is a doc that I can not change until I unlock it with specific switch.
    – user29422
    Commented Jan 3, 2013 at 17:37
  • 1
    A simpler solution, to me, would be to make a copy of the document. Edit one document. Only copy it to the other document when desired. Do you regularly turn off the auto-save feature of other office software?
    – ale
    Commented Jan 4, 2013 at 1:45

8 Answers 8

8

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.

4
  • good to know! (y)
    – OrangeBox
    Commented Jan 4, 2013 at 5:00
  • 1
    is there a way to always open it in View Mode or Edit Mode via a button or Menu item ?
    – user29422
    Commented Jan 4, 2013 at 11:14
  • Unfortunately no, the link always opens based on the permissions set in the doc. Since you're the owner, it will always default to "edit" Commented Jan 4, 2013 at 17:59
  • 3
    This doesn't work for me. If I change the URL to view, I can still edit. Commented May 12, 2015 at 19:13
12

This is now offered as an option in Google Docs:

enter image description here

(sorry about all of the blanked out personal info - ugly).

1
6

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.

enter image description here

3

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...

4
  • 1
    you are not serious ? another account for a simple lock ... anyway you can see that the question have been already set as answered , check the FAQ of the website to learn more
    – user29422
    Commented Jul 8, 2015 at 18:14
  • 2
    A second account is free, quick to set up and quick to switch to. It gives you complete ability to lock it as you see fit. I can't tell if you need to lock/unlock constantly, or just periodically. I don't know if the "View" setting alluded to above is persistent, it sounded like you might need to set it every time you open the document, and it will only be document-wide: with locking you could lock parts you don't want changed and actively edit other parts. Just mentioning the option. Commented Jul 9, 2015 at 19:22
  • 1
    I actually think this is a very smart solution, thanks for point it out Keith!
    – Love Dager
    Commented Sep 17, 2020 at 9:56
  • I'm reasonably sure we're allowed to add other options to already answered questions...
    – Joe
    Commented Dec 13, 2021 at 12:41
1

You can use this solution : https://webapps.stackexchange.com/a/37095/29140.

De-select the automatic re-publish option:
enter image description here enter image description here

Now every time you can check and dubble check before publishing.

2
  • 1
    it is a google document not google sheet.
    – user29422
    Commented Jan 3, 2013 at 15:40
  • 2
    The same is applicable to docs !!
    – Jacob Jan
    Commented Jan 3, 2013 at 15:49
0

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.

1
  • This is effectively the same solution from @KeithKeithBoBeith above.
    – shiri
    Commented Mar 27, 2022 at 17:57
0

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!');
}
-2

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.