GithubHelp home page GithubHelp logo

marksowell / google-workspace-automation Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3 KB

Google Workspace Automation is a collection of Google Apps Scripts for enhancing and automating functionalities within Google Workspace. The scripts streamline tasks in Sheets, Docs, Slides, and more, aiming to boost productivity and simplify workflows.

License: MIT License

google-workspace-automation's Introduction

Google Workspace Automation

This repository contains a collection of Google Apps Scripts designed to automate and enhance various functionalities within Google Workspace. The scripts provide custom solutions for tasks in Google Sheets, Docs, Slides, and more, aiming to increase productivity and streamline workflows.

Getting Started

To use these scripts, follow these general steps:

  1. Open the Google Workspace product (e.g., Google Sheets) where you want to use the script.
  2. Click on "Extensions" -> "Apps Script".
  3. In the Apps Script editor, delete any existing code and replace it with the script you want to use.
  4. Click on the disk icon or select "File" -> "Save" to save your script.
  5. Close the Apps Script Editor and refresh your Google Workspace product page. You should now see the "Automation Tools" menu in the toolbar.

Scripts

Lock File Script

This script adds a function to the "Automation Tools" menu in Google Sheets. The function "Lock this file" locks the current file, making it read-only.

To use this script, follow the general instructions above. Then:

  1. Click on "Services" -> "+ Add a service", then add "Drive API".
  2. Click on "Deploy" -> "New deployment", then select "Web app" and deploy the script. You may need to give permissions to the script to access your Google Drive.

After refreshing your Google Sheets page, you should see the "Automation Tools" menu. Click on it and select "Lock this file" to lock the current file.

The script can be found in the repository under the filename lock_file_script.js.

Here's the script:

function onOpen() {
  var ui = SpreadsheetApp.getUi();
  var menu = ui.getMenu('Automation Tools');
  if (!menu) {
    ui.createMenu('Automation Tools')
      .addItem('Lock this file', 'lockFile')
      .addToUi();
  } else {
    menu.addItem('Lock this file', 'lockFile');
  }
}

function lockFile() {
  var fileId = SpreadsheetApp.getActiveSpreadsheet().getId();
  var update = {
    contentRestrictions: [
      {
        readOnly: true,
        reason: 'Finalized contract.'
      }
    ]
  };
  Drive.Files.update(update, fileId);
}

Contributing

Contributions are welcome! If you have a script you'd like to add or an improvement to an existing script, feel free to create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.