Google Apps Script provides a way to automate and enhance the functionality of Google Sheets. One common task is to change the permissions of a Google Sheet from “view only” to “edit”. In this article, we will discuss how to use Google Apps Script to accomplish this task.

First, let’s understand the context in which you might want to change the permissions of a Google Sheet. Suppose you have a Google Sheet with some data that you want to share with your team. You want everyone to be able to view the data, but you also want everyone to be able to edit the data. By default, when you share a Google Sheet, it is set to “view only” mode. Only the owner of the sheet can edit it. However, you can change the permissions of the sheet to allow others to edit it as well.

Here’s how to change the permissions of a Google Sheet using Google Apps Script:

Step 1: Open your Google Sheet and go to the script editor

To open the script editor, go to “Tools” > “Script editor” in the Google Sheets menu bar.

Step 2: Write a script to modify the permissions

In the script editor, write a function that modifies the permissions of the sheet. Here’s an example script:

function updatePermissions() {
    var sheet = SpreadsheetApp.getActiveSpreadsheet();
    var editors = sheet.getEditors();
    for (var i = 0; i < editors.length; i++) {
        var editor = editors[i];

This script gets the active spreadsheet (i.e., the spreadsheet that the user is currently viewing), gets all the editors of the spreadsheet, and then removes and adds them back as editors. This effectively changes the sheet from “view only” to “edit” mode.

Step 3: Run the script

Save the script and then run it by clicking the “Run” button in the script editor. You will need to authorize the script to access your Google account.

Step 4: Verify the changes

After running the script, go back to your Google Sheet and verify that the permissions have been changed. The sheet should now be in “edit” mode, and everyone who had access to the sheet should now be able to edit it.

In conclusion, changing the permissions of a Google Sheet from “view only” to “edit” mode can be done using Google Apps Script. With just a few lines of code, you can modify the permissions of the sheet and enable collaboration among your team. By leveraging the power of Google Apps Script, you can automate and enhance various aspects of your Google Sheets, making them work more efficiently for you and your team.