Reads each Google Doc you list, summarizes it with AI, and appends every summary to one digest document.

UsesGoogle DocsOpenAI

Summarize a batch of documents into one digest

Give it a list of Google Docs links and one Google Doc to collect the results in, then run it whenever you have a batch to get through. Each document is read in turn, summarized by the AI following your own instructions, and added to the digest under its source link.

You end up with a dated block in the digest holding one summary per document, each followed by the link it came from. Every run adds a new block rather than replacing what is already there, so the digest becomes a running record you can search later, and summaries use only what each document says. A document that cannot be opened, whether a bad link, a file the connected account cannot reach or an empty page, is listed at the bottom under 'Could not be read' and the rest of the batch still goes through, so one broken link never costs you the whole run. Only Google Docs have text to read, so PDFs, spreadsheets and images land on that list too.

Set documentLinks to blank.Set documentLinks to blank.
Set digestDocumentLink to blank.Set digestDocumentLink to blank.
Set summaryInstructions to “Give at most three bullet points covering what the document is for and what it decides or asks for, then a final line starting 'Follow-ups:' naming any owners, dates or open questions it mentions.”.Set summaryInstructions to “Give at most three bullet points covering what the document is for and what it decides or asks for, then a final line starting 'Follow-ups:' naming any owners, dates or open questions it mentions.”.
Set maxCharactersPerDocument to 12000.Set maxCharactersPerDocument to 12000.
If digestDocumentLink starts with “http”If digestDocumentLink starts with “http”
Yes
If digestDocumentLink doesn't contain “/d/”If digestDocumentLink doesn't contain “/d/”
Yes
Stop and report a problem: The 'digestDocumentLink' step looks like a web address but is not a Google Docs link. Use one containing '/d/', such as https://docs.google.com/document/d/1AbCdEf/edit, or paste the document id.Stop and report a problem: The 'digestDocumentLink' step looks like a web address but is not a Google Docs link. Use one containing '/d/', such as https://docs.google.com/document/d/1AbCdEf/edit, or paste the document id.
No
No steps
No
No steps
Get the last item of digestDocumentLink split by “/d/” and save it as digestLinkTail.Get the last item of digestDocumentLink split by “/d/” and save it as digestLinkTail.
Get the first item of digestLinkTail split by “/” and save it as digestDocumentId.Get the first item of digestLinkTail split by “/” and save it as digestDocumentId.
If digestDocumentId is emptyIf digestDocumentId is empty
Yes
Stop and report a problem: The 'digestDocumentLink' step needs a Google Docs link such as https://docs.google.com/document/d/1AbCdEf/edit.Stop and report a problem: The 'digestDocumentLink' step needs a Google Docs link such as https://docs.google.com/document/d/1AbCdEf/edit.
No
No steps
Split documentLinks by a new line and save it as documentList.Split documentLinks by a new line and save it as documentList.
Set summaries to an empty list.Set summaries to an empty list.
Set skipped to an empty list.Set skipped to an empty list.
For each link in documentList:For each link in documentList:
Trim link and save it as documentLink.Trim link and save it as documentLink.
If documentLink is emptyIf documentLink is empty
Yes
Skip to the next item.Skip to the next item.
No
No steps
If documentLink starts with “http”If documentLink starts with “http”
Yes
If documentLink doesn't contain “/d/”If documentLink doesn't contain “/d/”
Yes
Add documentLink to the end of skipped and save it as skipped.Add documentLink to the end of skipped and save it as skipped.
Skip to the next item.Skip to the next item.
No
No steps
No
No steps
Get the last item of documentLink split by “/d/” and save it as linkTail.Get the last item of documentLink split by “/d/” and save it as linkTail.
Get the first item of linkTail split by “/” and save it as documentId.Get the first item of linkTail split by “/” and save it as documentId.
If documentId is emptyIf documentId is empty
Yes
Add documentLink to the end of skipped and save it as skipped.Add documentLink to the end of skipped and save it as skipped.
Skip to the next item.Skip to the next item.
No
No steps
Set documentText to blank.Set documentText to blank.
If a step below fails, save the error as readErrorIf a step below fails, save the error as readError
Try
Google DocsGoogle DocsRead documentId. Save it as document.Read documentId. Save it as document.
Trim document.text and save it as documentText.Trim document.text and save it as documentText.
On error
Show in the output: Could not read documentLink: readError as text.Show in the output: Could not read documentLink: readError as text.
If documentText is emptyIf documentText is empty
Yes
Add documentLink to the end of skipped and save it as skipped.Add documentLink to the end of skipped and save it as skipped.
Skip to the next item.Skip to the next item.
No
No steps
Set prompt to You are summarizing one document for a colleague who has not read it. Use only what the document says, and do not invent anything it does not contain.Set prompt to You are summarizing one document for a colleague who has not read it. Use only what the document says, and do not invent anything it does not contain. summaryInstructions Start your answer with a single line naming the document, then the summary. Document link: documentLink Document text: documentText truncated to maxCharactersPerDocument characters.
Set summary to blank.Set summary to blank.
If a step below fails, save the error as summaryErrorIf a step below fails, save the error as summaryError
Try
OpenAIOpenAIAsk OpenAI: prompt. Save it as modelReply.Ask OpenAI: prompt. Save it as modelReply.
Trim modelReply.response_text and save it as summary.Trim modelReply.response_text and save it as summary.
On error
Show in the output: Could not summarize documentLink: summaryError as text.Show in the output: Could not summarize documentLink: summaryError as text.
If summary is emptyIf summary is empty
Yes
Add documentLink to the end of skipped and save it as skipped.Add documentLink to the end of skipped and save it as skipped.
Skip to the next item.Skip to the next item.
No
No steps
Add summaryAdd summary Source: documentLink to the end of summaries and save it as summaries.
If summaries is emptyIf summaries is empty
Yes
Stop and report a problem: None of the documents could be read, so nothing was added to the digest. Check that every link in the 'documentLinks' step opens as a Google Doc for the connected account.Stop and report a problem: None of the documents could be read, so nothing was added to the digest. Check that every link in the 'documentLinks' step opens as a Google Doc for the connected account.
No
No steps
Set digest to Document summaries - today's dateSet digest to Document summaries - today's date summaries joined by a blank line.
If skipped isn't emptyIf skipped isn't empty
Yes
Change digest to digestChange digest to digest Could not be read: skipped joined by “, ”.
No
No steps
Google DocsGoogle DocsAdd text to digestDocumentId.Add text to digestDocumentId.digest
Show in the output: Added the length of summaries as text document summaries to the digest.Show in the output: Added the length of summaries as text document summaries to the digest.