Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darul75/excol
"Google sheets" mock
https://github.com/darul75/excol
google-sheets mock
Last synced: 14 days ago
JSON representation
"Google sheets" mock
- Host: GitHub
- URL: https://github.com/darul75/excol
- Owner: darul75
- License: mit
- Created: 2016-08-18T20:15:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-13T12:24:39.000Z (over 7 years ago)
- Last Synced: 2024-04-27T05:42:51.455Z (9 months ago)
- Topics: google-sheets, mock
- Language: TypeScript
- Homepage: https://darul75.github.io/excol/
- Size: 498 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# excol
[![Build Status](https://travis-ci.org/darul75/excol.svg?branch=master)](https://travis-ci.org/darul75/excol) [![codecov](https://codecov.io/gh/darul75/excol/branch/master/graph/badge.svg)](https://codecov.io/gh/darul75/excol)
Library to mock excel(-like) solutions in Javascript.
## Why
You may (should) write your own tests before deploying your code to solution like **Google sheet** or **Office 365**.
## Idea
In case of google app script, you can use their own editor to play with simple scripts but for bigger project it will become very complex to maintain.
What you may need is a tool to work locally and push back your changes to Google.
- Starter project https://github.com/danthareja/node-google-apps-script
- Mock everything with **Excol**## How to use
Google app script language is Javascript, a kind of, not ECMA 5 but an old one with most the basic necessary native features.
With starter kit provided before, you can named your files with .js extensions and play with it in a NodeJS environment (Tests).
Using a CJS manner, you just need to enhance your files a little bit this way.
*MyFunctions.js*
```javascript
/**
* NodeJS part for tests
*/
if (typeof exports === 'object' && typeof module !== 'undefined') {
var excol = require('excol');
var SpreadsheetApp = excol.SpreadsheetApp;
}function read() {
var activeSheet = SpreadsheetApp.getActiveSheet();
var range = activeSheet.getRange("A1:B2");
}function write() {
var activeSheet = SpreadsheetApp.getActiveSheet();
var range2 = activeSheet.getRange(1,1,2,2);
range2.setValues([
[1,2],
[3,4]
]);
}/**
* NodeJS part for tests
**/
if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = {
read: read,
write: write
};
//
// module.exports = read;
}
```*Main.js*
```javascript
/**
* NodeJS part for tests
*/
if (typeof exports === 'object' && typeof module !== 'undefined') {
var MyFunctions = require('MyFunctions');
}function main() {
MyFunctions.read();
MyFunctions.write();
}```