How to Make your Documents Read-only in Google Drive

The documents in your Google Drive are private of course and just the proprietor has beginning authorizations to see, alter or erase their records. On the off chance that you decide to impart a document to others, you can choose whether others have perused possibly admittance to your records or in the event that they are permitted to alter and remark on your records.

You can generally eliminate outside associates from your reports to keep them from altering your records however how would you forestall yourself (the proprietor) from unintentionally altering your own documents in Google Drive?

Google Drive currently has another Locking API to assist engineers with including content limitations archives, bookkeeping pages, introductions, PDF and some other document in Google Drive.

At the point when you lock a document, nobody (counting the proprietor) can make alters to the record, the record title can’t be changed and furthermore lose the choice of remarking inside documents.

Google Drive doesn’t have a basic catch (yet) for locking documents so here’s a little Google Script that can help you make any record in your Google Drive read-as it were.

  1. Open Google Drive and right-click any record that you wish to make a read-just document. Snap the Share Link menu and duplicate the document connect to the clipboard.
  1. Type in the program to open another Google Apps Script undertaking and duplicate glue this piece in the code proofreader.
 *  Make Google Drive files Read only
 *  Author:
 *  Web:
 *  MIT License
const makeFileReadyOnly = () => {
  const fileUrl = '<<FILE URL>>';
  const [fileId] = fileUrl.split('/').filter((e) => /[_-\w]{25,}/.test(e));
  UrlFetchApp.fetch(`${fileId}`, {
    method: 'PATCH',
    contentType: 'application/json',
    headers: {
      Authorization: `Bearer ${ScriptApp.getOAuthToken()}`,
    payload: JSON.stringify({
      contentRestrictions: [
          readOnly: true,
          reason: 'Prevent accidental editing',
  // For requesting correct scope, do not delete
  // var file = DriveApp.getFileById().setName()
  1. Supplant the FILE URL in line #2 with the URL of the Drive record that you duplicated in the past advance.
  2. Go to the Run menu, pick Run work > make File Ready Only. Acknowledge the authorizations and your document will confined from altering by anybody including yourself.

On the off chance that you might want to eliminate the document bolt and permit altering, open Google Drive, right snap a similar record and pick “Open document” from the menu to reestablish the altering conduct.

Kindly note that when you freeze an archive with the Google Drive Lock API, even Google Scripts and Google Workspace additional items are obstructed from altering the document.

Leave a Reply

Your email address will not be published. Required fields are marked *