0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

第2回:プロンプト不要?task列でAIの挙動を切り替えるテクニック

0
Posted at

はじめに

前回はGASからGemini APIを呼び出しました。

今回は実務で最も便利な設計を紹介します。

コードを書き換えることなく

  • 要約
  • 翻訳
  • 分類

を自由に切り替えられます。


連載記事で完成するスプレッドシート

スクリーンショット 2026-07-14 194423.png

シート構成

内容
A content
B task
C 結果

例えば

content task
長い文章 要約してください
こんにちは 英語にしてください
商品のレビュー 感情分類してください

GAS側はたったこれだけ

const content = sheet.getRange(row, 1).getValue();
const task = sheet.getRange(row, 2).getValue();

const fullPrompt =
`${task}

${content}`;

これをGeminiへ送るだけです。


AIの動き

例えば

要約してください

(長文)

要約結果


英語にしてください

こんにちは

Hello

感情分類してください

商品のレビュー

Positive

この設計のメリット

AIツールを

  • 要約用
  • 翻訳用
  • 分類用

と分ける必要がありません。

セルの入力だけでAIの役割が変わります。

これがスプレッドシート×AIで最もおすすめの設計です。


次回

第3回では、

100行でも200行でも一括実行できる

AIバッチ処理システム

を作ります。


現在、React + FastAPIで教育向けのデータ分析・機械学習プラットフォームを開発しています。

AI・機械学習・GAS関連の記事も継続して投稿予定です。


いいね・フォローしていただけると励みになります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?