@dgcode/spreadsheet-app
v0.1.55
Published
mocked classes for google apps script's SpreadsheetApp api
Downloads
22
Readme
@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