This file contains the complete SheetAPI implementation including:
- Main SheetAPI class for Google Sheets operations
- SheetAPITokenManager class for OAuth2 token management
- Comprehensive JSDoc documentation for all public and private methods
- Built-in caching mechanisms for performance optimization
- Automatic data validation and type casting
- Error handling and retry logic for API reliability
- Version:
- 1.0.0
- Copyright:
- 2025 SheetAPI
- License:
- MIT
- Source:
Examples
// Basic browser usage
<script src="SheetAPI.js"></script>
<script>
const api = new SheetAPI({
spreadsheetId: 'your-spreadsheet-id',
accessToken: 'your-oauth-token',
sheetName: 'Users'
});
api.init().then(() => {
return api.create({ name: 'John', email: 'john@example.com' });
}).then(result => console.log(result));
</script>
// Node.js usage with refresh token
const { SheetAPI } = require('./SheetAPI');
const api = new SheetAPI({
spreadsheetId: process.env.SPREADSHEET_ID,
refreshToken: process.env.REFRESH_TOKEN,
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
sheetName: 'Data'
});
Requires
- module:Google
- module:OAuth2