Skip to content

macap/gsorm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsorm

ORM for Spreadsheet in Google App Script

Overview

It automatically maps your sheet to javascript objects, using field names defined in first row. Allows you to easily do CRUD operations on your sheets.

Usage

Initialize model

const Model = Data_("SomeGoogleSpreadSheetId", ['foo', 'bar']);

foo, bar are sheet names you will use as a model. First row should contain field names

Use

// Get all objects
Model.foo.all();
// Update name column in first row with value "test" 
Model.foo.update(1, { name: "test" });
// Get name from first row
Model.foo.get(1).name;
// Remove first row
Model.foo.destroy(1);
// Create new row with value "test" in column "name"
Model.foo.create({name: "test"});
// Find row with value "test" in column "name"
Model.foo.find("name", "test");

Development

Tests:

yarn test

About

ORM for Google App Script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published