Every morning, has Claude pick the ten best stories logged in your news sheet, emails them to you with links, and clears the sheet.

UsesClaudeGmailGoogle Sheets

Daily news digest from your sheet

Every morning at 08:00, the stories another workflow has been logging into your news sheet are read, the ones most worth your time are chosen by AI against the interests you describe, and one plain text email with a summary and link for each lands in your inbox. Once it has gone, the tab is cleared so tomorrow's digest starts from tomorrow's stories.

Every headline and link in the email is looked up in the sheet itself, so nothing in your inbox is invented. If the tab is empty you still get an email saying so, because that usually means whatever fills it has stopped. If the sheet cannot be read, the ranking cannot be understood or the email cannot be sent, the run stops and the sheet is left untouched, so nothing is lost. The tab is cleared only after the email has been sent, and its header row is put back so logging can carry on.

Any columns will do in the news tab, though a title, a link and a summary make for a better digest.

Run every day at 08:00.Run every day at 08:00.
Set newsSheetUrl to blank.Set newsSheetUrl to blank.
Set newsTab to “News”.Set newsTab to “News”.
Set recipientEmail to blank.Set recipientEmail to blank.
Set interests to blank.Set interests to blank.
Set digestSize to 10.Set digestSize to 10.
Set maxStoriesToRank to 250.Set maxStoriesToRank to 250.
Get today's date and save it as today.Get today's date and save it as today.
Set dateLabel to “the weekday name of today today”.Set dateLabel to “the weekday name of today today”.
Set sheet to nothing.Set sheet to nothing.
If a step below fails, save the error as readErrorIf a step below fails, save the error as readError
Try
Google SheetsGoogle SheetsRead the rows of newsSheetUrl. Save it as sheet.Read the rows of newsSheetUrl. Save it as sheet.
On error
Stop and report a problem: The news sheet could not be read (readError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.Stop and report a problem: The news sheet could not be read (readError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.
Set stories to sheet.rows.Set stories to sheet.rows.
Count the items in stories and save it as totalLogged.Count the items in stories and save it as totalLogged.
If totalLogged is 0If totalLogged is 0
Yes
GmailGmailSend an email to recipientEmail.Send an email to recipientEmail. Subject: Daily news digest - nothing logged - dateLabelNo stories were logged in the '@newsTab' tab since the last digest, so there is nothing to send today. It is worth checking that whatever fills that sheet is still running.
Finish the run: The news sheet was empty; sent a note saying so instead of a digest.Finish the run: The news sheet was empty; sent a note saying so instead of a digest.
No
No steps
Set capped to false.Set capped to false.
If totalLogged is greater than maxStoriesToRankIf totalLogged is greater than maxStoriesToRank
Yes
Take stories from position totalLogged minus maxStoriesToRank on and save it as stories.Take stories from position totalLogged minus maxStoriesToRank on and save it as stories.
Change capped to true.Change capped to true.
No
No steps
Set catalogue to an empty list.Set catalogue to an empty list.
Set position to 0.Set position to 0.
For each story in stories:For each story in stories:
Add 1 to position.Add 1 to position.
Add Story positionAdd Story position story as a bulleted list truncated to 600 characters using “...” as the ellipsis to the end of catalogue and save it as catalogue.
Join catalogue with a blank line and save it as catalogueText.Join catalogue with a blank line and save it as catalogueText.
Set audience to “a general reader, judged by significance, novelty and usefulness”.Set audience to “a general reader, judged by significance, novelty and usefulness”.
If interests isn't blankIf interests isn't blank
Yes
Change audience to “a reader who has said they care about: interests”.Change audience to “a reader who has said they care about: interests”.
No
No steps
Set ranked to nothing.Set ranked to nothing.
If a step below fails, save the error as rankingErrorIf a step below fails, save the error as rankingError
Try
ClaudeClaudeAsk Claude: 'Below are the length of stories news stories logged since the last digest, each labeled 'Story' and a number, with the fields that were recorded for it. Choose the digestSize most worth reading for audience.Ask Claude: 'Below are the length of stories news stories logged since the last digest, each labeled 'Story' and a number, with the fields that were recorded for it. Choose the digestSize most worth reading for audience. Reply with the numbers of the stories you choose and nothing else: best first, one number per line. No titles, no reasons, no headings. Never give a number that is not in the list. If fewer stories than asked for are genuinely worth the reader's time, give fewer. Prefer stories that are significant, new rather than repeated, and useful to act on or worth knowing. When several rows report the same event, choose one of them. The stories: catalogueText'. Save it as ranked. Maximum response length: 400
On error
Stop and report a problem: Claude could not rank today's stories (rankingError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.Stop and report a problem: Claude could not rank today's stories (rankingError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.
Trim ranked.response_text and save it as rankingText.Trim ranked.response_text and save it as rankingText.
Extract all matches from rankingText and save it as picks.Extract all matches from rankingText and save it as picks.
Set chosen to an empty list.Set chosen to an empty list.
Set chosenPositions to an empty list.Set chosenPositions to an empty list.
For each pick in picks:For each pick in picks:
Set number to +pick.Set number to +pick.
If the length of chosen is less than digestSize and number is greater than or…If the length of chosen is less than digestSize and number is greater than or…
Yes
Add stories[number minus 1] to the end of chosen and save it as chosen.Add stories[number minus 1] to the end of chosen and save it as chosen.
Add number to the end of chosenPositions and save it as chosenPositions.Add number to the end of chosenPositions and save it as chosenPositions.
No
No steps
If chosen is emptyIf chosen is empty
Yes
Stop and report a problem: Claude's ranking could not be read as a list of story numbers. It replied: rankingText truncated to 300 characters using “...” as the ellipsis Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.Stop and report a problem: Claude's ranking could not be read as a list of story numbers. It replied: rankingText truncated to 300 characters using “...” as the ellipsis Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.
No
No steps
Set shortlist to an empty list.Set shortlist to an empty list.
Set rank to 0.Set rank to 0.
For each story in chosen:For each story in chosen:
Add 1 to rank.Add 1 to rank.
Add Story rankAdd Story rank story as a bulleted list truncated to 1500 characters using “...” as the ellipsis to the end of shortlist and save it as shortlist.
Join shortlist with a blank line and save it as shortlistText.Join shortlist with a blank line and save it as shortlistText.
Set emailBody to blank.Set emailBody to blank.
If a step below fails, save the error as writingErrorIf a step below fails, save the error as writingError
Try
ClaudeClaudeAsk Claude: 'Today is dateLabel. Below are the the length of chosen news stories chosen for today's digest, best first, each with the fields that were logged for it (usually a title, a link and a summary, sometimes a source and a date).Ask Claude: 'Today is dateLabel. Below are the the length of chosen news stories chosen for today's digest, best first, each with the fields that were logged for it (usually a title, a link and a summary, sometimes a source and a date). Write the email that delivers these stories. Rules you must follow: - Plain text only. No Markdown, no HTML, no asterisks, hashes or underscores: this is sent as a plain-text email. - Open with a one-line greeting for the day, then two or three sentences on what today's stories have in common or what stands out. - Then the stories, numbered, in the order given. For each one: the headline on its own line, one to three sentences of summary, then the link on its own line exactly as it appears in the fields below. - Use only what the fields below say. Do not invent facts, figures, quotes or links, and do not add stories. If a story's fields say little, say little. - Close with one short line. Output only the body of the email: no subject line. The stories, best first: shortlistText'. Save it as written. Maximum response length: 2500
Trim written.response_text and save it as emailBody.Trim written.response_text and save it as emailBody.
On error
Stop and report a problem: Claude could not write today's digest (writingError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.Stop and report a problem: Claude could not write today's digest (writingError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.
If emailBody is emptyIf emailBody is empty
Yes
Stop and report a problem: Claude returned an empty digest. Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.Stop and report a problem: Claude returned an empty digest. Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.
No
No steps
Set footer to Set footer to --- Chosen from totalLogged stories logged in the '@newsTab' tab since the last digest.
If capped is yesIf capped is yes
Yes
Change footer to “@footer Only the newest maxStoriesToRank were ranked.”.Change footer to “@footer Only the newest maxStoriesToRank were ranked.”.
No
No steps
If a step below fails, save the error as sendErrorIf a step below fails, save the error as sendError
Try
GmailGmailSend an email to recipientEmail.Send an email to recipientEmail. Subject: Daily news digest - dateLabelemailBody plus footer
On error
Stop and report a problem: The digest could not be sent (sendError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.Stop and report a problem: The digest could not be sent (sendError.message). Nothing was sent and the sheet was left as it is, so tomorrow's digest will have today's stories to choose from as well.
Set headerRow to an empty list.Set headerRow to an empty list.
If a step below fails, save the error as headerErrorIf a step below fails, save the error as headerError
Try
Google SheetsGoogle SheetsRead row 1 of newsTab in newsSheetUrl. Save it as headerCells.Read row 1 of newsTab in newsSheetUrl. Save it as headerCells.
Change headerRow to headerCells.values.Change headerRow to headerCells.values.
On error
Stop and report a problem: The digest was sent, but the header row of the news sheet could not be read (headerError.message), so the sheet was not cleared. Clear it by hand before tomorrow's stories arrive, or tomorrow's digest will repeat today's.Stop and report a problem: The digest was sent, but the header row of the news sheet could not be read (headerError.message), so the sheet was not cleared. Clear it by hand before tomorrow's stories arrive, or tomorrow's digest will repeat today's.
If headerRow is emptyIf headerRow is empty
Yes
Stop and report a problem: The digest was sent, but the first row of the news sheet is empty, so there is no header to put back after clearing. The sheet was left as it is: clear it by hand before tomorrow's stories arrive, or tomorrow's digest will repeat today's.Stop and report a problem: The digest was sent, but the first row of the news sheet is empty, so there is no header to put back after clearing. The sheet was left as it is: clear it by hand before tomorrow's stories arrive, or tomorrow's digest will repeat today's.
No
No steps
If a step below fails, save the error as clearErrorIf a step below fails, save the error as clearError
Try
Google SheetsGoogle SheetsClear the tab newsTab in newsSheetUrl.Clear the tab newsTab in newsSheetUrl.
On error
Stop and report a problem: The digest was sent, but the news sheet could not be cleared (clearError.message). Clear it by hand before tomorrow's stories arrive, or tomorrow's digest will repeat today's.Stop and report a problem: The digest was sent, but the news sheet could not be cleared (clearError.message). Clear it by hand before tomorrow's stories arrive, or tomorrow's digest will repeat today's.
If a step below fails, save the error as restoreErrorIf a step below fails, save the error as restoreError
Try
Google SheetsGoogle SheetsOverwrite row 1 of newsTab in newsSheetUrl.Overwrite row 1 of newsTab in newsSheetUrl.
On error
Stop and report a problem: The digest was sent and the news sheet was cleared, but its header row could not be written back (restoreError.message). Put this header row back before tomorrow's stories arrive: headerRow joined by “, ”.Stop and report a problem: The digest was sent and the news sheet was cleared, but its header row could not be written back (restoreError.message). Put this header row back before tomorrow's stories arrive: headerRow joined by “, ”.
Show in the output: Sent a digest of the length of chosen stories chosen from totalLogged and cleared the '@newsTab' tab for tomorrow.Show in the output: Sent a digest of the length of chosen stories chosen from totalLogged and cleared the '@newsTab' tab for tomorrow.