Config-Driven-Apps-Script-Framework
A modular, config-based framework to streamline Google Sheets development with Apps Script. Define layout, validation, formatting, and automation logic in one place using a central SHEETCONFIG and the SmartSheet utility class.
AI Summary
Config-Driven Apps Script Framework (CDAS)
A Google Apps Script library that lets you declare Google Sheets layout, validation, and automation in a single SHEETCONFIG object and operate them via a SmartSheet class.
Target Users
Intermediate-to-advanced GAS developers maintaining multi-sheet business spreadsheets.
Problems Solved
Sheet structure, validation, and onEdit logic are scattered across scripts, making maintenance difficult.
Script ID
- In GAS Editor: Click "Libraries +" → Paste into "Script ID" field → Click "Look up"
- "Config-Driven-Apps-Script-Framework" will appear in the search results
- Select the latest version (highest number) from "Version" dropdown
- Click "Add"
Tags
Centralized Configuration
Columns, named ranges, validation, formatting and edit rules are defined in one SHEETCONFIG object, eliminating scattered code.
SmartSheet Class
Provides high-level APIs such as row objects, calculated columns, and named-range access by semantic names.
Declarative Validation & Formatting
Create DataValidation and conditional formatting rules dynamically via functions and apply them automatically.
Rule-Based onEdit
Manage edit events declaratively by pairing conditions and handlers in onEditRules.
Calculated Columns & Named Ranges
Define inline formulas or functions for automatic calculations and optionally lock the resulting cells.
Read a row with minimal setup
/**
* Define a minimal SHEETCONFIG (config.gs)
*/
const SHEETCONFIG = {
Employees: {
layout: {
columns: {
A: { name: 'name', type: 'string' },
B: { name: 'age', type: 'number' }
}
}
}
};
/**
* Test function to read row data (Code.gs)
*/
function testReadRow() {
// Get the target sheet
const sheet = SpreadsheetApp.getActive()
.getSheetByName('Employees');
// Create SmartSheet instance
const smart = new SmartSheet(sheet);
// Fetch row 5 as an object, e.g. {name: 'Alice', age: 30}
const row = smart.getRowData(5);
Logger.log(row);
}Copy this snippet into your Apps Script project and prepare an "Employees" sheet—SmartSheet will fetch data by column names as shown.
