π Automated Apps Script deployment with Google Workspace APIs
This project provides a complete Google Apps Script solution for formatting Google Slides presentations, with fully automated deployment using the Google Drive API and Apps Script API.
π For detailed technical specifications, see SPECIFICATION.md - comprehensive architecture, API design, and implementation phases.
- Smart Font Swapping: Comic Sans MS β Arial (configurable)
- Batch Processing: Efficient API usage with intelligent batching
- Notes Support: Includes presentation notes pages
- Error Handling: Skip failed objects, continue processing
- One-Command Setup:
npm run deploycreates entire Apps Script project - API Management: Automatic Google API enablement
- OAuth Setup: Streamlined authentication flow
- Project Updates: Seamless updates to existing projects
- Modular Architecture: 7 specialized .gs files
- YAML Configuration: Designer-friendly settings
- Progress Tracking: Real-time UI with halt capability
- Deep Linking: Direct links to problematic slides
If you're setting up on a new development machine, these are the critical steps:
- Clone & Install:
git clone https://github.com/spm1001/slider.git && cd slider && npm install - Environment Variables:
cp .env.template .envthen edit.envwith your API keysβ οΈ MANDATORY - OAuth Credentials: Place your
credentials.jsonfile in project root - Deploy:
npm run deployand complete OAuth flow - Enable User APIs: Visit https://script.google.com/home/usersettings
β οΈ CRITICAL
- Node.js 14+
- Google Cloud Project with billing enabled
- Google Account with appropriate permissions
# Clone the project
git clone https://github.com/spm1001/slider.git
cd slider
npm install- Go to Google Cloud Console
- Create TWO API keys with different scopes:
- Development Key: Custom Search API (for MCP documentation lookup)
- Deployment Key: Apps Script + Drive + Slides + Sheets APIs
- Create OAuth 2.0 Client ID (Web application - not Desktop)
- Download OAuth client and save as
credentials.json - Enable required APIs: Drive, Slides, Sheets, Apps Script
π¨ CRITICAL: Visit https://script.google.com/home/usersettings and enable the Apps Script API
This user-level permission is required in addition to project-level API enablement. Without this step, deployment will fail with permission errors.
# Copy template and fill in your API keys
cp .env.template .env
# Edit .env with your actual API keys:
# GOOGLE_API_KEY=your_development_key_here (for MCP documentation lookup)
# DEPLOYMENT_API_KEY=your_deployment_key_here (for Apps Script deployment)π This step is mandatory - deployment will fail without both API keys properly configured in .env
# Deploy complete Apps Script project
npm run deploy
# Follow browser OAuth flow and copy authorization code- Open the generated Apps Script project URL
- Run
testFontSwap()function - Open any Google Sheets to see "Slide Formatter" menu
- Test with presentation:
1_WxqIvBQ2ArGjUqamVhVYKdAie5YrEgXmmUFMgNNpPA
main.gs # Entry point and orchestration
config.gs # YAML configuration management
slides-api.gs # Google Slides API client with retry logic
formatter.gs # Core formatting logic and batch processing
ui.gs # User interface and progress tracking
utils.gs # Utility functions and performance tools
constants.gs # API scopes, element types, defaults
deploy-web-manual.js # Web OAuth deployment script (Google Drive API)
package.json # Node.js dependencies and scripts
credentials.json # OAuth 2.0 web application credentials (user-provided)
token.json # Generated OAuth tokens (auto-created)
// In Google Sheets, use the menu:
// Slide Formatter β Format Presentation
// Enter: https://docs.google.com/presentation/d/YOUR_ID/edit# Settings β YAML Configuration
fontMappings:
- "Comic Sans MS": "Arial"
- "Times New Roman": "Helvetica"
- "Calibri": "Roboto"
processNotes: true
skipErrors: true
batchSize: 25
apiRetries: 5
apiRetryDelay: 2000// Direct function call in Apps Script
const config = getDefaultConfig();
const formatter = new SlideFormatter(config);
const result = formatter.formatPresentation('PRESENTATION_ID');| Setting | Description | Default | Range |
|---|---|---|---|
fontMappings |
Font replacement pairs | Comic Sans β Arial | Any font names |
processNotes |
Include notes pages | true |
boolean |
skipErrors |
Continue on errors | true |
boolean |
batchSize |
API batch size | 50 |
1-100 |
apiRetries |
Retry attempts | 3 |
1-10 |
apiRetryDelay |
Retry delay (ms) | 1000 |
100+ |
"Service invoked too many times"
# Reduce batch size and increase delays
batchSize: 25
apiRetryDelay: 2000"Permission denied"
- Ensure presentation is accessible
- Check if presentation is in "Suggesting" mode
- Verify OAuth scopes are properly configured
"Invalid presentation URL"
- Use full Google Slides URL
- Format:
https://docs.google.com/presentation/d/ID/edit
# Manual API enablement
https://console.cloud.google.com/apis/dashboard
Required APIs:
β’ Google Drive API
β’ Google Slides API
β’ Google Sheets API
β’ Apps Script API- Ensure credentials.json is from Web Application type (not Desktop)
- Check that all required scopes are included
- Clear token.json if authentication fails
- Capacity: 50+ slides, 20+ objects per slide
- Speed: <60 seconds for typical presentations
- Memory: <100MB peak usage
- Success Rate: >95% of objects processed correctly
- API Efficiency: Intelligent batching with rate limiting
[
'https://www.googleapis.com/auth/presentations', // Modify slides
'https://www.googleapis.com/auth/drive.readonly', // Read templates
'https://www.googleapis.com/auth/spreadsheets' // UI integration
][
'https://www.googleapis.com/auth/drive', // Create projects
'https://www.googleapis.com/auth/drive.scripts' // Upload scripts
]# Update existing project with new code
npm run deploy # Automatically detects and updates existing project// Process multiple presentations
const presentations = ['ID1', 'ID2', 'ID3'];
presentations.forEach(id => processPresentation(id));// Automatic deep link generation
https://docs.google.com/presentation/d/ID/edit#slide=id.SLIDE_ID- Edit .gs files locally
- Test with
npm run deploy - Verify in Apps Script editor
- Test in Google Sheets
git add *.gs deploy.js package.json
git commit -m "Update font formatting logic"# In CI/CD pipeline
npm install
npm run deploy # Automated deployment- URL:
1_WxqIvBQ2ArGjUqamVhVYKdAie5YrEgXmmUFMgNNpPA - Test: Comic Sans MS β Arial font swap
- Scope: All slides + notes pages
- Expected: <60 seconds, >95% success rate
- Create test presentation with various fonts
- Add to configuration for automated testing
- Verify results with detailed reporting
- Edit appropriate .gs file
- Update constants.gs if needed
- Run
npm run deployto test - Submit pull request
- Include presentation ID (if public)
- Provide error logs from execution transcript
- Specify configuration used
MIT License - see LICENSE file for details
- Google Workspace APIs for comprehensive functionality
- Apps Script platform for serverless execution
- Drive API for automated deployment capabilities
Ready to transform your slide formatting workflow? π¨
Run npm run deploy and start automating your Google Slides formatting today!