ChatGPT lost its Google Drive connector right as the weekly school digest was humming along. Rather than stitch together workarounds, I pulled the AI step into Google Apps Script, dropped in a Gemini API key, and kept the digest flowing. Total time: about 45 minutes.
What changed from the last post
In Bringing AI Into Everyday Life, I leaned on ChatGPT to summarize the calendar and newsletter scrape. When Drive access disappeared, the schedule stopped. The new approach keeps everything inside Google: the scrape, the summarization, and the final doc creation in Drive. No external callbacks to manage.
The 45-minute fix
- Removed the ChatGPT schedule and external call.
- Created a script property for the Gemini API key so nothing lives in code.
- Used native UrlFetchApp to call Gemini for summaries.
- Left the existing parsers intact—just swapped the model call and kept the Drive write step.
Gemini in Apps Script (tiny example)
const key = PropertiesService.getScriptProperties().getProperty('GEMINI_API_KEY');
const prompt = buildDigestPrompt(digestedText); // existing digest text
const response = UrlFetchApp.fetch(
'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=' + key,
{
method: 'post',
contentType: 'application/json',
payload: JSON.stringify({
contents: [{ parts: [{ text: prompt }]}]
})
}
);
const summary = JSON.parse(response.getContentText())
?.candidates?.[0]?.content?.parts?.[0]?.text || '';
With that in place, the weekly trigger runs, Gemini writes the summary, and the digest lands in Google Drive without leaving the Google ecosystem.
Setup in short
- Add the Gemini API key to Script Properties.
- Swap the old ChatGPT call for the UrlFetchApp snippet above.
- Keep the existing Drive write and weekly trigger. Done.
The updated code lives here: weekly-school-digest-automation.
The best part: once everything stayed inside Google, the digest stopped breaking when connectors moved around.
Why keep it all in Google
Drive permissions, triggers, and API calls are all first-party now. No more waiting on external connectors to catch up, and no lost digests when tokens expire. It's simple, reliable, and still easy to tweak.
Setup links and quick steps
- Open Google Apps Script and create a new project.
- Paste in the code, set a weekly trigger, and save.
- In Google Cloud Console, enable the Gemini API and create an API key.
- Back in Apps Script, add the key in Script Properties as
GEMINI_API_KEY. - Run once to authorize; the weekly digest will then run on schedule.