@dgcode/spreadsheet-app
TypeScript icon, indicating that this package has built-in type declarations

0.1.55 • Public • Published

@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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.554latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.554
0.1.260
0.1.250
0.1.160
0.1.80

Package Sidebar

Install

npm i @dgcode/spreadsheet-app

Weekly Downloads

3

Version

0.1.55

License

MIT

Unpacked Size

1.25 MB

Total Files

291

Last publish

Collaborators

  • dgcoder