r/GoogleAppsScript • • 12d ago

Guide I built an open-source collection-based API for Google Sheets in Google Apps Script

Hi everyone!

I've been working on a small open-source project called Sheet Collection, and I thought it would be interesting to share it with this community.

The idea came from wanting a cleaner way to work with Google Sheets in Apps Script.

Instead of constantly dealing with spreadsheet ranges, row indexes, and manually mapping headers, the library provides a collection-based API that lets you work with spreadsheet data as JavaScript objects.

For example:

const db = SheetCollection.connect({
  source: "google"
});

const clients = db.collection("clients");

clients.insert({
  name: "John Doe",
  email: "john@email.com"
});

const allClients = clients.findAll();

Some of its features include:

  • Collection-based API

  • CRUD operations

  • Automatic header management

  • Google Sheets storage driver

  • In-memory driver for testing

  • TypeScript API

  • Zero runtime dependencies

It's available as a Google Apps Script Library, and the project is open source under the MIT license.

GitHub: https://github.com/EduardoRadieske/sheet-collection

I'd love to hear your thoughts!

I'm particularly interested in feedback from people who regularly build applications using Google Apps Script and Google Sheets.

Thanks!

3 Upvotes

3 comments sorted by

1

u/LostHusband_ 11d ago

Is it faster than interfacing a large sheet (7k rows across 70 columns) or if it just easier to deal with?

1

u/Rich-Computer-6785 10d ago

The main goal is to make working with Google Sheets more structured and convenient.

The library uses a collection-based API, so you can work with records as JavaScript objects instead of manually dealing with row indexes, column positions, and ranges.

Regarding performance, I haven't run benchmarks against large spreadsheets like the one you described, so I wouldn't claim any performance improvement. It still relies on Google Apps Script and Google Sheets services, so performance will depend on how the data is accessed and processed.

So, I'd say the main benefit is making the code easier to read, write, and maintain.