0.1.55 • Published 6 years ago

@dgcode/spreadsheet-app v0.1.55

Weekly downloads
36
License
MIT
Repository
-
Last release
6 years ago

@dgcode/spreadsheet-app

mocked classes for google apps script's SpreadsheetApp api

Install

$ npm install @dgcode/spreadsheet-app

Usage

import { SpreadsheetApp } from '@dgcode/spreadsheet-app';

const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
const sheet = spreadsheet.getSheets()[0];
sheet.getRange(1, 1).setValue('Hello World!');

Features

  • Node.js-compatible: simulate Google Apps Script code by testing locally first
  • Embeddable into Google Apps Script via gscript module

Caveats

Google frequently updates its Apps Script API so this package may fall out of sync at some point. If you really need all the brand-new features they implement, you should mock them yourself at the beginning of your script:

import { SpreadsheetApp } from '@dgcode/spreadsheet-app';

if ('function' !== typeof SpreadsheetApp.someNewMethod) {
  Object.assign(SpreadsheetApp, {
    someNewMethod: function() {
      // ...
    }
  });
}

// mock ready, now run rest of app logic
// ...
import { SpreadsheetApp, Sheet } from '@dgcode/spreadsheet-app';

if ('function' === typeof Sheet && 'function' !== typeof Sheet.prototype.someNewSheetMethod) {
  Object.assign(Sheet.prototype, {
    someNewSheetMethod: function() {
      // ...
    }
  });
}

// mock ready, now run rest of app logic
// ...

License

MIT

0.1.55

6 years ago

0.1.26

7 years ago

0.1.25

7 years ago

0.1.16

7 years ago

0.1.8

7 years ago