Extrait public
Verrouillé
Spec confirmed first, then a complete .gs file: CONFIG object, getValues / setValues in batch, columns looked up by header, LockService, try / catch to a Log tab, rerun-safe week key, DRY_RUN flag, createTriggers() and a test plan on a copy of the sheet…
À propos de ce prompt
Automates a recurring Google Sheets chore (weekly consolidation, summary email, threshold alerts) with a robust Apps Script: configuration in one place, batch reads and writes, headers found by name, lock against overlapping runs, a log tab, a dry-run mode and a time-driven trigger. Designed for Gemini and Google Workspace users; totals are always computed by the script, never by the AI.
Exemple de résultat
```javascript
/** @OnlyCurrentDoc */
const CONFIG = {
sourceTabs: ['North', 'South', 'East', 'West'],
targetTab: 'Consolidated',
logTab: 'Log',
headers: { date: 'Date', region: 'Region', amount: 'Net amount' },
weeklyTarget: { North: 12000, South: 9000, East: 9000, West: 7500 },
recipients: ['ops-managers@example.com'],
DRY_RUN: true,
};
function weeklyReport() {
const lock = LockService.getScriptLock();
if (!lock.tryLock(30000)) return log_('weeklyReport', 'Another run in progress, skipped');
try {
const weekKey = getLastWeekKey_(); // e.g. "2025-W44"
if (alreadyProcessed_(weekKey)) return log_('weeklyReport', weekKey + ' already done');
const rows = collectRows_(weekKey); // batch getValues, columns by header
const totals = totalsByRegion_(rows);
…
} catch (e) {
log_('weeklyReport', 'ERROR ' + e.message);
MailApp.sendEmail(Session.getEffectiveUser().getEmail(), 'Weekly report failed', e.stack);
} finally {
lock.releaseLock();
}
}
```
Test 3 — duplicate run: the second run logs "2025-W44 already done" and appends nothing…
Fiche technique
- Modèle
- Gemini
- Langue du prompt
- Anglais
- Pour qui
- Operations, finance and marketing staff who repeat the same Google Sheets task every week
- Longueur
- ~597 tokens (estimation)
- Format livré
- Texte du prompt, affiché en ligne après achat
- Rayon
- Data & Analyse
Avis
Aucun avis pour l'instant. Seuls les acheteurs de ce prompt peuvent en laisser un.