Fetches each video transcript you list, summarizes the whole thing section by section with AI, and logs it to a sheet.

UsesGoogle SheetsOpenAI

Summarize long videos from their transcripts

Give it a list of transcript links, one per line with an optional title, and run it whenever you have a batch of videos to get through. Each transcript is fetched, cut into sections along its own line breaks and read section by section by the AI, which notes the actual claims in each part. Those notes are then written up as one summary in the style you describe, with key points underneath, so the end of a long talk is covered too.

You end up with a 'Video summaries' tab in your Google Sheet holding one row per video: date, title, transcript link, word count, sections covered, summary and key points. The tab is created on the first run and added to after that, never overwritten. A transcript that cannot be fetched or comes back empty is reported and skipped while the rest go through, and a very long one is capped at a set number of sections, with the row saying how many were read.

Transcripts must be reachable by link; the video itself cannot be read.

Set transcriptLinks to blank.Set transcriptLinks to blank.
Set reportSheetUrl to blank.Set reportSheetUrl to blank.
Set summaryStyle to “One tight paragraph in plain English for someone who has not seen the video, naming the speaker's actual claims rather than the topics they touched on.”.Set summaryStyle to “One tight paragraph in plain English for someone who has not seen the video, naming the speaker's actual claims rather than the topics they touched on.”.
Set reportTabName to “Video summaries”.Set reportTabName to “Video summaries”.
Set charactersPerSection to 8000.Set charactersPerSection to 8000.
Set maxSectionsPerVideo to 10.Set maxSectionsPerVideo to 10.
Set summaryModel to “gpt-5.4-mini”.Set summaryModel to “gpt-5.4-mini”.
Set tabIsNew to false.Set tabIsNew to false.
If a step below fails, save the error as createTabErrorIf a step below fails, save the error as createTabError
Try
Google SheetsGoogle SheetsCreate the tab reportTabName in reportSheetUrl.Create the tab reportTabName in reportSheetUrl.
Change tabIsNew to true.Change tabIsNew to true.
On error
Show in the output: The '@reportTabName' tab is already there, so this run adds to it. (createTabError.message).Show in the output: The '@reportTabName' tab is already there, so this run adds to it. (createTabError.message).
If tabIsNew is yesIf tabIsNew is yes
Yes
Google SheetsGoogle SheetsAdd a row to reportTabName in reportSheetUrl.Add a row to reportTabName in reportSheetUrl.
No
No steps
Split transcriptLinks by a new line and save it as transcriptEntries.Split transcriptLinks by a new line and save it as transcriptEntries.
Set videosSummarised to 0.Set videosSummarised to 0.
For each transcriptEntry in transcriptEntries:For each transcriptEntry in transcriptEntries:
Trim transcriptEntry and save it as entryText.Trim transcriptEntry and save it as entryText.
If entryText is emptyIf entryText is empty
Yes
Skip to the next item.Skip to the next item.
No
No steps
Split entryText by “|” and save it as entryParts.Split entryText by “|” and save it as entryParts.
Trim the last item of entryParts and save it as transcriptUrl.Trim the last item of entryParts and save it as transcriptUrl.
Trim the first item of entryParts and save it as videoLabel.Trim the first item of entryParts and save it as videoLabel.
If transcriptUrl is emptyIf transcriptUrl is empty
Yes
Skip to the next item.Skip to the next item.
No
No steps
If videoLabel is emptyIf videoLabel is empty
Yes
Change videoLabel to transcriptUrl.Change videoLabel to transcriptUrl.
No
No steps
Set transcriptText to blank.Set transcriptText to blank.
Set transcriptReached to false.Set transcriptReached to false.
If a step below fails, save the error as fetchErrorIf a step below fails, save the error as fetchError
Try
Fetch transcriptUrl and save it as response.Fetch transcriptUrl and save it as response.
Change transcriptReached to response.ok.Change transcriptReached to response.ok.
Trim response.body and save it as transcriptText.Trim response.body and save it as transcriptText.
On error
Show in the output: Could not open the transcript at transcriptUrl - fetchError.message.Show in the output: Could not open the transcript at transcriptUrl - fetchError.message.
If transcriptReached isn't yes or transcriptText is emptyIf transcriptReached isn't yes or transcriptText is empty
Yes
Show in the output: No transcript text came back from transcriptUrl, so nothing was summarized for videoLabel.Show in the output: No transcript text came back from transcriptUrl, so nothing was summarized for videoLabel.
Skip to the next item.Skip to the next item.
No
No steps
Count the words in transcriptText and save it as transcriptWords.Count the words in transcriptText and save it as transcriptWords.
Split transcriptText by a new line and save it as transcriptLines.Split transcriptText by a new line and save it as transcriptLines.
Start an empty list and save it as sections.Start an empty list and save it as sections.
Set currentSection to blank.Set currentSection to blank.
For each transcriptLine in transcriptLines:For each transcriptLine in transcriptLines:
If the length of currentSection plus the length of transcriptLine plus 1 is…If the length of currentSection plus the length of transcriptLine plus 1 is…
Yes
Add currentSection to the end of sections and save it as sections.Add currentSection to the end of sections and save it as sections.
Change currentSection to blank.Change currentSection to blank.
No
No steps
Change currentSection to currentSection@transcriptLineChange currentSection to currentSection@transcriptLine .
If currentSection isn't blankIf currentSection isn't blank
Yes
Add currentSection to the end of sections and save it as sections.Add currentSection to the end of sections and save it as sections.
No
No steps
If the length of sections is greater than maxSectionsPerVideoIf the length of sections is greater than maxSectionsPerVideo
Yes
Show in the output: The transcript for videoLabel is the length of sections as text sections long, so only the first maxSectionsPerVideo as text were summarized. Raise 'maxSectionsPerVideo' to cover the whole thing.Show in the output: The transcript for videoLabel is the length of sections as text sections long, so only the first maxSectionsPerVideo as text were summarized. Raise 'maxSectionsPerVideo' to cover the whole thing.
No
No steps
Start an empty list and save it as sectionNotes.Start an empty list and save it as sectionNotes.
Set sectionsRead to 0.Set sectionsRead to 0.
For each section in sections:For each section in sections:
If sectionsRead is greater than or equal to maxSectionsPerVideoIf sectionsRead is greater than or equal to maxSectionsPerVideo
Yes
Stop repeating.Stop repeating.
No
No steps
Add 1 to sectionsRead.Add 1 to sectionsRead.
Shorten section to charactersPerSection characters (keeping words whole) and save it as sectionText.Shorten section to charactersPerSection characters (keeping words whole) and save it as sectionText.
If a step below fails, save the error as sectionErrorIf a step below fails, save the error as sectionError
Try
OpenAIOpenAIAsk OpenAI: 'You are reading one part of a video transcript and writing down what it actually says.Ask OpenAI: 'You are reading one part of a video transcript and writing down what it actually says. Write the points this part makes as short bullets, each on its own line starting with a dash. Keep names, numbers, definitions and conclusions exactly as they are stated, and do not add anything that is not in the text. The transcript may contain timestamps, caption cue numbers and speaker labels - ignore them. If this part is only an introduction, filler or an advertisement, reply with the single word none. Video: videoLabel Part sectionsRead as text of the length of sections as text of the transcript: sectionText'. Save it as sectionReply.
Trim sectionReply.response_text and save it as sectionNote.Trim sectionReply.response_text and save it as sectionNote.
If sectionNote isn't empty and sectionNote is not “none”If sectionNote isn't empty and sectionNote is not “none”
Yes
Add sectionNote to the end of sectionNotes and save it as sectionNotes.Add sectionNote to the end of sectionNotes and save it as sectionNotes.
No
No steps
On error
Show in the output: Could not read part sectionsRead as text of videoLabel - sectionError.message.Show in the output: Could not read part sectionsRead as text of videoLabel - sectionError.message.
If sectionNotes is emptyIf sectionNotes is empty
Yes
Show in the output: Nothing usable came back for videoLabel, so no row was written for it.Show in the output: Nothing usable came back for videoLabel, so no row was written for it.
Skip to the next item.Skip to the next item.
No
No steps
Join sectionNotes with a blank line and save it as combinedNotes.Join sectionNotes with a blank line and save it as combinedNotes.
Set sectionsUsed to “the length of sectionNotes as text of the length of sections as text”.Set sectionsUsed to “the length of sectionNotes as text of the length of sections as text”.
Set summaryText to blank.Set summaryText to blank.
Set keyPoints to blank.Set keyPoints to blank.
If a step below fails, save the error as summaryErrorIf a step below fails, save the error as summaryError
Try
OpenAIOpenAIAsk OpenAI: 'You are writing the summary of one video from notes taken in order across its whole transcript.Ask OpenAI: 'You are writing the summary of one video from notes taken in order across its whole transcript. Write the summary in this style: summaryStyle Then write a line containing exactly KEY POINTS: and, under it, the points a reader should take away, one per line starting with a dash. Add no other headings, and never mention the notes or the transcript. Video: videoLabel Notes taken across the transcript, in order: combinedNotes'. Save it as finalReply.
Trim finalReply.response_text and save it as answer.Trim finalReply.response_text and save it as answer.
Split answer by “KEY POINTS:” and save it as answerParts.Split answer by “KEY POINTS:” and save it as answerParts.
Trim the first item of answerParts and save it as summaryText.Trim the first item of answerParts and save it as summaryText.
If the length of answerParts is greater than 1If the length of answerParts is greater than 1
Yes
Trim the last item of answerParts and save it as keyPoints.Trim the last item of answerParts and save it as keyPoints.
No
No steps
On error
Show in the output: Could not summarize videoLabel - summaryError.message.Show in the output: Could not summarize videoLabel - summaryError.message.
If summaryText is emptyIf summaryText is empty
Yes
Show in the output: No summary came back for videoLabel, so no row was written for it.Show in the output: No summary came back for videoLabel, so no row was written for it.
Skip to the next item.Skip to the next item.
No
No steps
If a step below fails, save the error as writeErrorIf a step below fails, save the error as writeError
Try
Google SheetsGoogle SheetsAdd a row to reportTabName in reportSheetUrl.Add a row to reportTabName in reportSheetUrl.
Add 1 to videosSummarised.Add 1 to videosSummarised.
On error
Show in the output: Could not add the summary for videoLabel to the sheet - writeError.message.Show in the output: Could not add the summary for videoLabel to the sheet - writeError.message.
Show in the output: Summarized videosSummarised as text video(s) into the '@reportTabName' tab.Show in the output: Summarized videosSummarised as text video(s) into the '@reportTabName' tab.