Giter VIP home page Giter VIP logo

google-apps-script-sheetio's Introduction

🔌 Google Apps Script SheetIO

license Followers Stars Line Count Commit Count Repo Size

Easy to use Google Apps Script Spreadsheet API (using Method chaining)

Features

  • ⚡️ Installing scripts into your project Super-Fast!
  • ⚡️ Easy to use, data insertion and styling
  • ⚡️ Handling of external Google Sheets files
  • ⚡️ Support for a variety of utility methods to simplify sheet operations

Installation

Step 1. Install clasp

In order to properly use all configuration of clasp, you need to change the Enabled setting of Google Apps Script API to 'Enable' after logging in with your Google account on the next page: https://script.google.com/home/usersettings

The clasp package must be installed for automatic installation in Google Drive.

$ npm install -g @google/clasp

If you have set up the development environment in this project, you can install it through npm i, so you don't need to install the package globally.

You may need a clasp login before proceeding. Skip if you have already done this:

$ clasp login

Step 2-A. Create Google SpreadSheet script in your workspace

You can create Google Sheets and script projects in Google Drive. We recommend running your own scripts with everything integrated.

[Method 1] Create automatically (recommended)

This npm script helps you quickly and easily push scripts to your new spreadsheet file using clasp.

$ npm run create

[Method 2] Create manually

$ clasp create

Follow the clasp's prompts to create a spreadsheet in the Google Drive top-level path. After you open that sheet, the script will be installed automatically.

Make sure a .clasp.json file is created in your project root. After that, you can install the script into the document with the command below.

$ clasp push

Step 2-B. Manual Installation

If you already have a Google Script project created, or if you want to add your own script files, follow the steps below.

Put the SheetIO.js file in project directory into your new Google Apps Script project file and use it.

You can also use additional App.js and Test.js files if necessary.

Usage

// Create a SheetIO instance.
const Sheet = new SheetIO();

// Create a new sheet 'Users'.
Sheet.create('Users');

// Specifies where the currently active sheet is, allowing cells to be processed.
const targetSheet = Sheet.active('Users');

// The general method is similar to that of the Google Apps Script Spreadsheet.
targetSheet.getRange(1, 1).getValue();

// Continuous use possible with method chaining.
targetSheet
  .clearAll()
  .insertLastRow([['ID', 'Name', 'Age', 'Gender', 'Created', 'Updated', 'Subscription']])
  .insertLastRow([
    ['1', 'Lee', '26', 'M', '2021-11-01', '2021-11-01', 'Y'],
    ['2', 'James', '31', 'M', '2021-10-25', '2021-11-15', 'N'],
    ['3', 'Katy', '25', 'W', '2020-09-11', '2021-05-24', 'Y'],
    ['4', 'Betty', '27', 'W', '2021-03-09', '2021-11-11', 'N'],
    ['5', 'Mike', '32', 'M', '2020-07-29', '2020-09-06', 'N']
  ]);

Using API / Methods

Related descriptions are attached to the entire method of SheetIO.js, and the main method of the default API commonly used in Spreadsheet of Google Apps Script is overridden.

Not all Spreadsheet methods may be compatible. If there is a method you would like to request, please leave an issue or send a PR.

See: https://developers.google.com/apps-script/reference/spreadsheet

License

Copyright © 2021-2024 Jooy2 <[email protected]> Released under the MIT license.

google-apps-script-sheetio's People

Contributors

dependabot[bot] avatar jooy2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

thegreatgaspy

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.