See llms.txt for all machine-readable content.

Back to Templates

Summarize TDnet watchlist disclosures with Google Gemini, Sheets and Slack

Quick overview

This workflow runs every weekday morning (JST) to check a Google Sheets stock watchlist, fetch recent TDnet disclosure PDFs via a TDnet web API, summarize and classify them with Google Gemini, then post a digest (and high-impact alerts) to Slack while logging results and errors back to Google Sheets.

How it works

  1. Runs on a weekday cron schedule at 08:30 JST, computes a lookback window that expands over weekends/holidays, and skips the run entirely if today is configured as a market holiday.
  2. Reads the stock watchlist from Google Sheets, normalizes and de-duplicates securities codes, and stops with an error if no valid active codes are found.
  3. Queries the TDnet endpoint once per code, flattens results, and keeps only disclosures published within the computed JST time window.
  4. Reads the disclosure log from Google Sheets and filters out disclosures that were already logged so reruns don’t repost the same items.
  5. Downloads each new disclosure PDF, extracts text (falling back to title-only when extraction fails), and sends the content to Google Gemini to return a structured category, impact, direction, and 3-line Japanese/English summaries.
  6. Appends the enriched disclosure entries to the Google Sheets disclosure log, posts a grouped digest message to the configured Slack channel, and sends an additional Slack alert for any high-impact disclosure.
  7. Logs TDnet fetch or Gemini summarization errors to a Google Sheets error log and posts a single aggregated error alert to Slack.

Setup

  1. Create a Google Sheets spreadsheet with three tabs for a watchlist (with at least code/name/active columns), a disclosure log, and an error log.
  2. Add Google Sheets credentials, a Google Gemini API credential (Google Gemini/Vertex connection used by the Gemini chat model), and Slack credentials.
  3. In the configuration step, set the watchlist/log/error sheet URLs, the Slack channel name, the TDnet list endpoint template, and optionally holidays (YYYY-MM-DD) plus limits like lookback hours and max disclosures per run.