Overview
SGD-MCS uses a centralized configuration system defined inBackend/core/config.js. All configuration constants, database mappings, and color schemes are defined here and automatically available across all Google Apps Script files.
The configuration file is loaded globally, so all constants are accessible in every
.gs file without imports.Core Configuration
Database Connection
The Google Sheets spreadsheet ID that serves as the database.Location: Backend/core/config.js:11
The Google Drive folder ID where all system files are stored.Location: Backend/core/config.js:14If left empty, the system will create a folder named
SGD_DATABASE_ROOT in the user’s Drive root.Sheet Mappings
TheSHEETS object maps logical entity names to actual Google Sheets tab names:
Sheet Structure
| Constant | Tab Name | Purpose |
|---|---|---|
ESTUDIANTES | Estudiantes | Student records |
DOCENTES | Docentes | Faculty/advisor records |
EXTERNOS | ParticipantesExternos | External participants |
INSTITUCIONES | Instituciones | Partner institutions |
TESIS | Tesis | Thesis records |
EVENTOS | Eventos | Academic events |
PARTICIPACIONES | Participaciones | Event participation (M:N relation) |
HISTORIAL | Historial_Documentos | Document audit trail |
CONFIG | Configuracion | System counters and settings |
Color Palette
The system uses a predefined color scheme for visual consistency:Utility Functions
getDB()
Returns the database spreadsheet instance:SpreadsheetApp.openById() throughout your code.
getAppConfig()
Returns the complete configuration object for the frontend:Time Zone Configuration
The system timezone is configured inappsscript.json:
Environment Variables
Configure Drive Folder
Update
ROOT_FOLDER_ID with your Google Drive folder ID, or leave empty for auto-creation.Best Practices
Version Control
Version Control
Always commit configuration changes to version control with clear documentation of what changed and why.
Environment Separation
Environment Separation
Use separate spreadsheets and folders for development, staging, and production environments.
Backup Before Changes
Backup Before Changes
Create a backup copy of the spreadsheet before modifying critical configuration values.
Test Configuration
Test Configuration
After changing configuration, test all CRUD operations to ensure connectivity.
Troubleshooting
Database Connection Failed
Symptom: Functions return errors about missing spreadsheetSolution: Verify
SPREADSHEET_ID is correct and the service account has access.Drive Folder Not Found
Symptom: Files cannot be uploaded or organizedSolution: Check
ROOT_FOLDER_ID exists and has proper permissions, or set to empty string for auto-creation.Sheet Not Found
Symptom: Operations fail with “Sheet not found” errorsSolution: Ensure all sheet names in
SHEETS constant match actual tab names in the spreadsheet exactly.Next Steps
Database Structure
Learn about the database schema and sheet structure
Google Apps Script
Deploy and manage the Apps Script backend