{"id":749,"date":"2026-08-16T23:21:23","date_gmt":"2026-08-16T14:21:23","guid":{"rendered":"https:\/\/tako.nakano.net\/blog\/?p=749"},"modified":"2026-08-16T23:21:27","modified_gmt":"2026-08-16T14:21:27","slug":"calling-vertex-ai-gemini-from-gas","status":"publish","type":"post","link":"https:\/\/tako.nakano.net\/blog\/2026\/08\/calling-vertex-ai-gemini-from-gas\/","title":{"rendered":"Vertex AI \u306e Gemini \u3092 GAS (Google Apps Script) \u304b\u3089\u547c\u3073\u51fa\u3059"},"content":{"rendered":"<h1>Vertex AI \u306e Gemini \u3092 GAS (Google Apps Script) \u304b\u3089\u547c\u3073\u51fa\u3059<\/h1>\n<p>English follows Japanese.<\/p>\n<h2>\u6982\u8981<\/h2>\n<p>\u4e3b\u306a\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e4\u70b9\u3067\u3042\u308b\u3002<\/p>\n<ul>\n<li>GAS \u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u306e\u65e7\u79f0 Vertex AI \u30b5\u30fc\u30d3\u30b9\uff08Agent Platform API \u30b5\u30fc\u30d3\u30b9\uff09\u304c\u305d\u306e\u307e\u307e\u4f7f\u3048\u308b<\/li>\n<li>\u540d\u79f0\u30fb\u4e26\u3073\u9806\u306b\u6ce8\u610f\uff08\u4eca\u5f8c\u306e\u6539\u79f0\u306b\u3082\u6ce8\u610f\uff09<\/li>\n<li>API \u30ad\u30fc\u304c\u4e0d\u8981<\/li>\n<li>\u5b9f\u884c\u8005\u3067\u6a29\u9650\u7ba1\u7406\u304c\u53ef\u80fd<\/li>\n<\/ul>\n<p>GAS \u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u306e\u5229\u7528\u3067\u3001<code>UrlFetchApp<\/code> \u3092\u4f7f\u308f\u305a\u306b Gemini Enterprise Agent Platform API \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u3064\u307e\u308a\u3001\u80cc\u5f8c\u3067 POST \u30ea\u30af\u30a8\u30b9\u30c8\u304c\u884c\u308f\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u5168\u304f\u610f\u8b58\u305b\u305a\u306b\u300150\u884c\u7a0b\u5ea6\uff08\u30b3\u30a2\u90e8\u5206\u306f5\u884c\u7a0b\u5ea6\uff09\u306e\u30b3\u30fc\u30c9\u3067\u5b9f\u88c5\u3067\u304d\u308b\u3002<\/p>\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>Gemini \u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u547c\u3073\u51fa\u3059\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308b\u304c\u3001AI Studio \u7b49\u304b\u3089\u5229\u7528\u3055\u308c <code>generativelanguage.googleapis.com<\/code> \u3068\u3044\u3046\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f7f\u3046 &#8220;Gemini API&#8221;\uff08\u540d\u524d\u304c\u7d1b\u3089\u308f\u3057\u3044\uff09\u3068\u3001\uff08Google Cloud \u306e\uff09Gemini Enterprise Agent Platform API \u3067\u63d0\u4f9b\u3055\u308c\u308b <code>aiplatform.googleapis.com<\/code> \u3068\u3044\u3046\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f7f\u3046 &#8220;Agent Platform API&#8221;\uff08\u65e7\u79f0 Vertex AI API\uff09\u306e2\u7a2e\u985e\u306f\u826f\u304f\u77e5\u3089\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001GAS (Google Apps Script) \u304b\u3089 Gemini Enterprise Agent Platform API \u3092 <code>UrlFetchApp<\/code> \u3092\u300c\u4f7f\u308f\u305a\u306b\u300d\u547c\u3073\u51fa\u3059\u65b9\u6cd5\u306b\u3064\u3044\u3066\u89e3\u8aac\u3059\u308b\u3002\u3064\u307e\u308a\u3001\u80cc\u5f8c\u3067 POST \u30ea\u30af\u30a8\u30b9\u30c8\u304c\u884c\u308f\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u5168\u304f\u610f\u8b58\u305b\u305a\u306b\u300150\u884c\u7a0b\u5ea6\uff08\u30b3\u30a2\u90e8\u5206\u306f5\u884c\u7a0b\u5ea6\uff09\u306e\u30b3\u30fc\u30c9\u3067\u5b9f\u88c5\u3067\u304d\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/developers.google.com\/apps-script\/release-notes#January_12_2026\">2026-01-12 \u306e\u30ea\u30ea\u30fc\u30b9\u30ce\u30fc\u30c8<\/a> \u306b\u3042\u308b\u3088\u3046\u306b\u3001GAS \u306e\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u3068\u3057\u3066 Vertex AI \u30b5\u30fc\u30d3\u30b9\u304c\u8ffd\u52a0\u3055\u308c\u305f\uff08\u53c2\u8003: <a href=\"https:\/\/officeforest.org\/wp\/google-apps-script%E3%81%ABvertex-ai-service%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F\/\">Google Apps Script\u306bVertex AI Service\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f<\/a>\uff09\u3002\u3053\u308c\u306b\u3088\u308a\u3001GAS \u304b\u3089 Gemini Enterprise Agent Platform API \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u3063\u305f\u3002<br \/>\n\u5f53\u6642\u306f Vertex AI API \u3068\u3057\u3066\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u305f cf. https:\/\/officeforest.org\/wp\/wp-content\/uploads\/2026\/01\/G-i51rQbQAEbb1O.webp \u304c\u30012026-08-16 \u73fe\u5728\u3067\u306f (Gemini Enterprise) Agent Platform API \u306b\u6539\u79f0\u3055\u308c\u3066\u304a\u308a\u3001 &#8220;A&#8221; \u306e\u3068\u3053\u308d\u306b\u4e26\u3093\u3067\u3044\u308b\u3002\u3053\u306e\u305f\u3081\u3001\u89e3\u8aac\u8a18\u4e8b\u3092\u66f8\u304f\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<p>&#8220;Gemini API&#8221; \u3068 &#8220;Agent Platform API&#8221; \u306e\u9055\u3044\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"#\u5099\u8003\">\u5099\u8003<\/a> \u3067\u5c11\u3057\u89e6\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u53c2\u7167\u3057\u3066\u307b\u3057\u3044\u3002<\/p>\n<h3>\u5c0e\u5165\u65b9\u6cd5<\/h3>\n<p>Google Cloud \u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210\u3084 API\uff08\u30b5\u30fc\u30d3\u30b9\uff09\u306e\u6709\u52b9\u5316\u306b\u3064\u3044\u3066\u306f\u3001\u624b\u9806\u3092\u7701\u7565\u3059\u308b\u3002\u89e3\u8aac\u8a18\u4e8b\u306f\u8c4a\u5bcc\u306a\u306e\u3067\u3001\u7686\u3055\u3093\u3067\u8abf\u3079\u3066\u307b\u3057\u3044\u3002<\/p>\n<p>\u307e\u305a\u306f\u4ee5\u4e0b\u306e\u6e96\u5099\u304c\u5fc5\u8981\u3067\u3042\u308b:<\/p>\n<ol>\n<li>Google Cloud Project \u3092\u4f5c\u6210\u3059\u308b<\/li>\n<li>Gemini Enterprise Agent Platform API \u3092\u6709\u52b9\u5316\u3059\u308b<\/li>\n<\/ol>\n<p>\u4f5c\u6210\u5f8c\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 ID \u3092\u63a7\u3048\u3066\u304a\u304f\u3002\u5f8c\u3067 GAS \u306e\u30b9\u30af\u30ea\u30d7\u30c8 \u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p>\u7d9a\u3044\u3066\u3001GAS \u306e\u74b0\u5883\u6e96\u5099\u3092\u884c\u3046\u3002\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u30b3\u30f3\u30c6\u30ca\u3068\u3059\u308b GAS \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<ol>\n<li>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/li>\n<li>\u5b50\u30b7\u30fc\u30c8\u540d\uff08\u30b7\u30fc\u30c81\uff09\u3092 &#8220;gemini&#8221; \u306b\u3059\u308b<\/li>\n<li>\u62e1\u5f35\u6a5f\u80fd\u30e1\u30cb\u30e5\u30fc\u304b\u3089 Apps Script \u3092\u958b\u304f<\/li>\n<li>\u30b5\u30fc\u30d3\u30b9\u304b\u3089 Agent Platform API \u3092 &#8220;VertexAI&#8221; \u3068\u3044\u3046\u540d\u524d\u3067\u8ffd\u52a0\u3059\u308b \u203b A \u306e\u3068\u3053\u308d\u306b\u3042\u308b\n<ul>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/add-service.png\" alt=\"\u300c\u30b5\u30fc\u30d3\u30b9\u300d\u304b\u3089\u9078\u629e\u753b\u9762\u3092\u958b\u304f\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/select-service.png\" alt=\"\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u306e\u300cAgent Platform API\u300d\u306e\u9078\u629e\uff08ID \u306f VertexAI \u3060\u3051\u3069\uff09\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/seek-a.png\" alt=\"\u4e26\u3073\u9806\u306f A \u306e\u3068\u3053\u308d\u306b\u3042\u308b\u306e\u3067\u3001V \u306e\u3068\u3053\u308d\u306b\u306f\u306a\u3044\" \/><\/li>\n<\/ul>\n<\/li>\n<li>\u300c\u30d5\u30a1\u30a4\u30eb\u300d\u304b\u3089\u300c\u30b9\u30af\u30ea\u30d7\u30c8\u300d\u3092\u8ffd\u52a0\u3057\u3001&#8221;main&#8221; \u3068\u3044\u3046\u540d\u524d\u306b\u3059\u308b<\/li>\n<li>\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u308b\uff08\u5f8c\u8ff0<a href=\"#\u30b3\u30fc\u30c9\">\u30b3\u30fc\u30c9<\/a>\uff09<\/li>\n<li>\u30b9\u30af\u30ea\u30d7\u30c8 \u30d7\u30ed\u30d1\u30c6\u30a3\u306b <code>PROJECT_ID<\/code>, <code>REGION<\/code>, <code>MODEL_NAME<\/code> \u3092\u8a2d\u5b9a\u3059\u308b <img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/set-script-property.png\" alt=\"\u30b9\u30af\u30ea\u30d7\u30c8\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u8a2d\u5b9a\" \/><\/li>\n<li>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u30ea\u30ed\u30fc\u30c9\u3059\u308b<\/li>\n<li>\u30b7\u30fc\u30c8\u306e A2, A3 \u306b\u300cGemini \u306b\u805e\u304d\u305f\u3044\u5185\u5bb9\u300d\u3092\u5165\u529b\u3057\u3066\u304a\u304f <img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/sheet-input.png\" alt=\"\u30b7\u30fc\u30c8\u3078\u306e\u5165\u529b\u4f8b\" \/><\/li>\n<\/ol>\n<p>\u672c\u8a18\u4e8b\u6700\u5927\u306e\u30dd\u30a4\u30f3\u30c8\u306f <strong>&#8220;A&#8221; \u306e\u3068\u3053\u308d\u306b VertexAI \u304c\u4e26\u3093\u3067\u3044\u308b<\/strong> \u70b9\u306b\u6ce8\u610f\u3059\u308b\u3053\u3068\u3067\u3042\u308b\u3002GAS \u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u306e\u767a\u8868\u5f53\u6642\u306f Vertex AI API \u3068\u3057\u3066\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u305f cf. https:\/\/officeforest.org\/wp\/wp-content\/uploads\/2026\/01\/G-i51rQbQAEbb1O.webp \u304c\u30012026-08-16 \u73fe\u5728\u3067\u306f (Gemini Enterprise) Agent Platform API \u306b\u6539\u79f0\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3060\u3002\u672c\u8a18\u4e8b\u3092\u66f8\u304f\u306b\u81f3\u3063\u305f\u6700\u5927\u306e\u52d5\u6a5f\u306f\u3053\u3053\u3067\u3042\u308b\u3002\u4eca\u5f8c\u3082\u30b5\u30fc\u30d3\u30b9\u540d\u306e\u6539\u79f0\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u540c\u69d8\u306b\u30e1\u30cb\u30e5\u30fc\u4e0a\u306e\u4f4d\u7f6e\u304c\u5909\u308f\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u306e\u3067\u3001\u3053\u3053\u306b\u8a18\u3057\u3066\u304a\u304f\u3002\u6ce8\u610f\u3057\u3066\u307b\u3057\u3044\u3002<\/p>\n<h3>\u5b9f\u884c\u65b9\u6cd5<\/h3>\n<p><code>onOpen<\/code> \u95a2\u6570\u306b\u3088\u3063\u3066\u30e1\u30cb\u30e5\u30fc\u304c\u8ffd\u52a0\u3055\u308c\u308b\u4ed5\u7d44\u307f\u306b\u3057\u3066\u3042\u308b\u3002<\/p>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u30ea\u30ed\u30fc\u30c9\u3059\u308b\u3002<\/p>\n<ol>\n<li>\u30e1\u30cb\u30e5\u30fc\u304c\u8ffd\u52a0\u3055\u308c\u308b\u306e\u3067\u9078\u629e <img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-menu.png\" alt=\"\u30b7\u30fc\u30c8\u753b\u9762\u306e\u30e1\u30cb\u30e5\u30fc\" \/><\/li>\n<li>\u8a8d\u8a3c\u3092\u8a31\u53ef\u3059\u308b\uff08\u521d\u56de\u5b9f\u884c\u6642\u306e\u307f\uff09\n<ul>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-1.png\" alt=\"\u8a8d\u8a3c\u304c\u5fc5\u8981\u3067\u3059\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-2.png\" alt=\"\u30a2\u30d7\u30ea\u306e\u78ba\u8a8d\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-3.png\" alt=\"\u5148\u306b\u9032\u3080\" \/><\/li>\n<\/ul>\n<\/li>\n<li>\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u304c\u51fa\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u5148\u306b\u9032\u3080<br \/>\n<img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-4.png\" alt=\"\u7d9a\u884c\u306e\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\" \/><\/li>\n<li>\u9078\u629e\u3057\u3066\u53f3\u4e0b\u306e\u7d9a\u884c<\/li>\n<li>\u51fa\u529b\u304c\u57cb\u307e\u308b<br \/>\n<img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/sheet-filled.png\" alt=\"\u30b7\u30fc\u30c8\u306e\u30bb\u30eb\u304c\u57cb\u307e\u308b\" \/><\/li>\n<\/ol>\n<h3>\u30b3\u30fc\u30c9<\/h3>\n<p>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u306f\u3001\u30b7\u30fc\u30c8\u306e A2, A3 \u30bb\u30eb\u306b\u66f8\u304b\u308c\u305f\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u3001Gemini API \u306b\u6e21\u3057\u3066\u3001\u7d50\u679c\u3092 B2, B3 \u30bb\u30eb\u306b\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>GitHub \u306e\u30ea\u30dd\u30b8\u30c8\u30ea <a href=\"https:\/\/github.com\/takotakot\/misc\/blob\/main\/gas_vertexai_gemini\/dist\/index.js\">gas_vertexai_gemini\/dist\/index.js<\/a> \u306b\u540c\u3058\u30d5\u30a1\u30a4\u30eb\u3092\u7f6e\u3044\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u3061\u3089\u3082\u53c2\u8003\u306b\u3057\u3066\u307b\u3057\u3044\u3002<br \/>\n<a href=\"https:\/\/github.com\/google\/aside\">ASIDE<\/a>\uff08GAS \u306e\u958b\u767a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\uff09\u3067\u521d\u671f\u5316\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066 TypeScript \u7248\u3082\u3042\u308b\u306e\u3067\u3001TypeScript \u3067\u66f8\u304d\u305f\u3044\u4eba\u306f\u305d\u3061\u3089\u3092\u53c2\u8003\u306b\u3057\u3066\u307b\u3057\u3044\u3002<\/p>\n<p>\u540c\u69d8\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3001\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3084\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u3082\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u9069\u5b9c\u53c2\u8003\u306b\u3057\u3066\u307b\u3057\u3044\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/developers.google.com\/apps-script\/advanced\/vertex-ai\">Vertex AI \u30b5\u30fc\u30d3\u30b9<\/a><\/li>\n<li><a href=\"https:\/\/officeforest.org\/wp\/google-apps-script%E3%81%ABvertex-ai-service%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F\/#i-7\">\u901a\u5e38\u306e\u30ea\u30af\u30a8\u30b9\u30c8<\/a> \uff08\u76f4\u5f8c\u306b\u306f\u3001\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u4ed8\u3051\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u65b9\u6cd5\u3084\u3001Claude4 \u3092\u547c\u3073\u51fa\u3059\u65b9\u6cd5\u3082\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\uff01\uff09<\/li>\n<\/ul>\n<pre><code class=\"language-javascript\">function callVertexAiGenerateContent(prompt) {\n  const scriptProperties = PropertiesService.getScriptProperties();\n  const projectId =\n    scriptProperties.getProperty('PROJECT_ID') ??\n    scriptProperties.getProperty('projectId') ??\n    '';\n  const region =\n    scriptProperties.getProperty('REGION') ??\n    scriptProperties.getProperty('region') ??\n    'global';\n  const modelName =\n    scriptProperties.getProperty('MODEL_NAME') ??\n    scriptProperties.getProperty('modelName') ??\n    'gemini-3.7-flash';\n  if (!projectId) {\n    throw new Error('Project ID is not configured in Script Properties.');\n  }\n  const model = `projects\/${projectId}\/locations\/${region}\/publishers\/google\/models\/${modelName}`;\n  const payload = {\n    contents: [\n      {\n        role: 'user',\n        parts: [\n          {\n            text: prompt,\n          },\n        ],\n      },\n    ],\n  };\n  const response = VertexAI.Endpoints.generateContent(payload, model);\n  return (\n    response?.candidates?.[0]?.content?.parts?.[0]?.text ??\n    'No response from Gemini API'\n  );\n}\n\nfunction runGeminiAPI() {\n  const sheet = SpreadsheetApp.getActiveSheet();\n  const promptA2 = String(sheet.getRange('A2').getValue() ?? '');\n  if (promptA2) {\n    try {\n      const resultB2 = callVertexAiGenerateContent(promptA2);\n      sheet.getRange('B2').setValue(resultB2);\n    } catch (error) {\n      const message = error instanceof Error ? error.message : String(error);\n      console.error(`Failed to call Vertex AI: ${message}`);\n    }\n  }\n  const promptA3 = String(sheet.getRange('A3').getValue() ?? '');\n  if (promptA3) {\n    try {\n      const resultB3 = callVertexAiGenerateContent(promptA3);\n      sheet.getRange('B3').setValue(resultB3);\n    } catch (error) {\n      const message = error instanceof Error ? error.message : String(error);\n      console.error(`Failed to call Vertex AI: ${message}`);\n    }\n  }\n}\n\nfunction onOpen() {\n  const ui = SpreadsheetApp.getUi();\n  ui.createMenu('Gemini')\n    .addItem('Read sheet and invoke Gemini API and write', runGeminiAPI.name)\n    .addToUi();\n}\n<\/code><\/pre>\n<h2>\u5099\u8003<\/h2>\n<p><code>generativelanguage.googleapis.com<\/code> \u3068 <code>aiplatform.googleapis.com<\/code> \u306f\u9055\u3046\u3082\u306e\u3067\u3042\u308b\u3002\u524d\u8005\u306f Google \u306e AI Studio \u306a\u3069\u304b\u3089\u5229\u7528\u3055\u308c\u308b Gemini API \u3067\u3001\u4e3b\u306b API \u30ad\u30fc\u3092\u4f7f\u3063\u3066\u5229\u7528\u3059\u308b\u3002OAuth2 \u306e\u5c0e\u5165\u3082\u53ef\u80fd\u3067\u3042\u308b\u304c\u9762\u5012\u3067\u3042\u308b\u3002<\/p>\n<p>\u4e00\u65b9\u3001\u5f8c\u8005\u306e <code>aiplatform.googleapis.com<\/code> \u306f\u3001AI Platform API \u304b\u3089 Vertex AI API \u306b\u6539\u79f0\u3055\u308c\u3001\u66f4\u306b\u3001Gemini Enterprise Agent Platform API \u306b\u6539\u79f0\u3055\u308c\u305f\u3002\u3053\u3061\u3089\u306f\u3001GAS \u7d44\u307f\u8fbc\u307f\u306e\u8a8d\u8a3c\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u547c\u3073\u51fa\u305b\u308b\u305f\u3081\u3001\u5225\u9014 OAuth2 \u306e\u8a2d\u5b9a\u7b49\u3092\u884c\u3046\u5fc5\u8981\u304c\u306a\u3044\u3002<a href=\"https:\/\/zenn.dev\/west_river\/articles\/gas-vertex-ai-image-analyzer\">GAS \u00d7 Vertex AI (Gemini) \u3067\u753b\u50cf\u89e3\u6790\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u308b<\/a> \u3084 <a href=\"https:\/\/zenn.dev\/ohimusdev46301\/articles\/84f8cf5feaa6f6\">API\u30ad\u30fc\u4e0d\u8981\uff01GAS\u304b\u3089OAuth\u8a8d\u8a3c\u3067Gemini\u3092\u547c\u3073\u51fa\u3059<\/a> \u306f <code>UrlFetchApp<\/code> \u3092\u4f7f\u3063\u305f\u65b9\u6cd5\u3067\u3042\u308b\u304c\u3001\u3053\u308c\u3059\u3089\u3082\u4f7f\u3046\u5fc5\u8981\u304c\u306a\u3044\u3002\u306a\u304a API \u30ad\u30fc\u3067\u547c\u3073\u51fa\u3059\u3053\u3068\u3082\u53ef\u80fd\u3067\u3042\u308b\u304c\u3001\u8a00\u53ca\u306b\u7559\u3081\u3001\u7d30\u304b\u3044\u65b9\u6cd5\u306f\u7701\u7565\u3059\u308b\u3002<br \/>\n\u662f\u975e\u3001<code>UrlFetchApp<\/code> \u3092\u300c\u4f7f\u308f\u305a\u306b\u300d\u5229\u7528\u3057\u3066\u307b\u3057\u3044\u3002<\/p>\n<p>\u306a\u304a\u3001<code>VertexAI.Endpoints.generateContent(payload, model)<\/code> \u304c\u300c\u4e00\u822c\u7684\u306a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u3069\u3053\u3068\u3069\u3046\u540c\u3058\u304b\u300d\u3092\u7c21\u5358\u306b\u8abf\u3079\u3066\u307f\u305f\u306e\u3060\u304c\u3001\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>REST API \u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3042\u308b\u3002<br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest<\/a><br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest#rest-resource:-v1.projects.locations.endpoints\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest#rest-resource:-v1.projects.locations.endpoints<\/a><br \/>\n<a href=\"https:\/\/ai.google.dev\/api\/all-methods?hl=ja#service-endpoint\">https:\/\/ai.google.dev\/api\/all-methods?hl=ja#service-endpoint<\/a><\/p>\n<p>Interactions API \u306f Vertex AI (Gemini Enterprise Agent Platform) \u5074\u3067\u306f\u30012026-08-16 \u73fe\u5728\u307e\u3060\u958b\u767a\u4e2d\u306e\u69d8\u5b50\u3067\u3042\u308b\u3002\u3053\u3061\u3089\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3089\u7d9a\u5831\u3092\u66f8\u304d\u305f\u3044\u3068\u601d\u3046\u3002<br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/models\/interactions-api\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/models\/interactions-api<\/a><br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\/v1beta1\/projects.locations.interactions\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\/v1beta1\/projects.locations.interactions<\/a><\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001GAS (Google Apps Script) \u306e\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3001Vertex AI \u306e Gemini (Gemini Enterprise Agent Platform API) \u3092\u547c\u3073\u51fa\u3059\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u305f\u3002<\/p>\n<p>\u5f93\u6765\u306e <code>UrlFetchApp<\/code> \u3092\u7528\u3044\u305f HTTP \u30ea\u30af\u30a8\u30b9\u30c8\u3084\u9762\u5012\u306a OAuth2 \u8a8d\u8a3c\u30fbAPI \u30ad\u30fc\u7ba1\u7406\u3092\u884c\u308f\u305a\u306b\u3001\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067\u308f\u305a\u304b\u6570\u884c\u306e\u30b3\u30fc\u30c9\u304b\u3089\u5b89\u5168\u304b\u3064\u76f4\u611f\u7684\u306b Gemini \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<p>\u6700\u5927\u306e\u6ce8\u610f\u70b9\u306f\u3001\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u306e\u540d\u79f0\u304c <strong>Agent Platform API<\/strong> \u306b\u6539\u79f0\u3055\u308c\u305f\u3053\u3068\u306b\u3088\u308a\u3001\u30b5\u30fc\u30d3\u30b9\u306e\u8ffd\u52a0\u4e00\u89a7\u3067\u306e\u4e26\u3073\u9806\u304c <strong>&#8220;A&#8221;<\/strong> \u306e\u4f4d\u7f6e\u306b\u306a\u3063\u3066\u3044\u308b\u70b9\u3067\u3042\u308b\uff08\u8b58\u5225\u5b50\u306f <code>VertexAI<\/code> \u306e\u307e\u307e\uff09\u3002<\/p>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u306f\u3058\u3081\u3068\u3059\u308b Google Workspace \u3068 Gemini \u306e\u9023\u643a\u304c\u3053\u308c\u307e\u3067\u4ee5\u4e0a\u306b\u624b\u8efd\u306b\u306a\u308b\u305f\u3081\u3001\u305c\u3072\u672c\u8a18\u4e8b\u306e\u624b\u9806\u3067\u8a66\u3057\u3066\u307f\u3066\u307b\u3057\u3044\u3002<\/p>\n<h2>\u53c2\u8003<\/h2>\n<ul>\n<li><a href=\"https:\/\/developers.google.com\/apps-script\/release-notes#January_12_2026\">Google Apps Script Release Notes (January 12, 2026)<\/a><\/li>\n<li><a href=\"https:\/\/developers.google.com\/apps-script\/advanced\/vertex-ai\">Google Apps Script Advanced Services &#8211; Vertex AI \u30b5\u30fc\u30d3\u30b9<\/a><\/li>\n<li><a href=\"https:\/\/officeforest.org\/wp\/google-apps-script%E3%81%ABvertex-ai-service%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F\/\">Google Apps Script\u306bVertex AI Service\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f &#8211; Office Forest<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/takotakot\/misc\/blob\/main\/gas_vertexai_gemini\/dist\/index.js\">GitHub: takotakot\/misc (\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9)<\/a><\/li>\n<li><a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\">Gemini Enterprise Agent Platform API REST Reference<\/a><\/li>\n<li><a href=\"https:\/\/zenn.dev\/west_river\/articles\/gas-vertex-ai-image-analyzer\">GAS \u00d7 Vertex AI (Gemini) \u3067\u753b\u50cf\u89e3\u6790\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u308b &#8211; Zenn<\/a><\/li>\n<li><a href=\"https:\/\/zenn.dev\/ohimusdev46301\/articles\/84f8cf5feaa6f6\">API\u30ad\u30fc\u4e0d\u8981\uff01GAS\u304b\u3089OAuth\u8a8d\u8a3c\u3067Gemini\u3092\u547c\u3073\u51fa\u3059 &#8211; Zenn<\/a><\/li>\n<\/ul>\n<hr \/>\n<h1>Calling Vertex AI Gemini from Google Apps Script (GAS)<\/h1>\n<h2>Overview<\/h2>\n<p>The key points are the following four:<\/p>\n<ul>\n<li>The GAS advanced service formerly called Vertex AI Service (now Agent Platform API Service) can be used as-is<\/li>\n<li>Pay attention to the name and alphabetical order (and to future renames)<\/li>\n<li>No API key required<\/li>\n<li>Access control is managed by the executing user&#8217;s identity<\/li>\n<\/ul>\n<p>By using the GAS advanced service, you can call the Gemini Enterprise Agent Platform API without using <code>UrlFetchApp<\/code>. In other words, you can implement this in about 50 lines of code (around 5 lines for the core logic) without having to worry about the underlying POST requests.<\/p>\n<h2>Introduction<\/h2>\n<p>There are several ways to call Gemini programmatically. Two well-known approaches are the &#8220;Gemini API&#8221; (a confusingly named API) that uses the <code>generativelanguage.googleapis.com<\/code> endpoint accessed from AI Studio and similar tools, and the &#8220;Agent Platform API&#8221; (formerly Vertex AI API) provided by the (Google Cloud) Gemini Enterprise Agent Platform API that uses the <code>aiplatform.googleapis.com<\/code> endpoint.<\/p>\n<p>This article explains how to call the Gemini Enterprise Agent Platform API from GAS (Google Apps Script) <strong>without<\/strong> using <code>UrlFetchApp<\/code>. You will see how to implement it with only about 50 lines of code (around 5 lines for the core logic), completely abstracting away the underlying HTTP requests.<\/p>\n<p>As noted in the <a href=\"https:\/\/developers.google.com\/apps-script\/release-notes#January_12_2026\">January 12, 2026 release notes<\/a>, the Vertex AI Service was added as a GAS advanced service (see also: <a href=\"https:\/\/officeforest.org\/wp\/google-apps-script%E3%81%ABvertex-ai-service%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F\/\">Vertex AI Service added to Google Apps Script<\/a>). This made it possible to call the Gemini Enterprise Agent Platform API from GAS.<br \/>\nAt that time, the advanced service was listed as &#8220;Vertex AI API&#8221; (cf. https:\/\/officeforest.org\/wp\/wp-content\/uploads\/2026\/01\/G-i51rQbQAEbb1O.webp), but as of 2026-08-16, it has been renamed to &#8220;(Gemini Enterprise) Agent Platform API&#8221; and is sorted under &#8220;A&#8221;. This prompted me to write this article.<\/p>\n<p>For the difference between the &#8220;Gemini API&#8221; and the &#8220;Agent Platform API,&#8221; see the <a href=\"#notes\">Notes<\/a> section below.<\/p>\n<h3>How to Set Up<\/h3>\n<p>Detailed steps for creating a Google Cloud project and enabling the API (service) are omitted here, as plenty of comprehensive guides are available online.<\/p>\n<p>First, the following preparation is required:<\/p>\n<ol>\n<li>Create a Google Cloud Project<\/li>\n<li>Enable the Gemini Enterprise Agent Platform API<\/li>\n<\/ol>\n<p>After creation, make a note of the project ID. You will set it in the GAS script properties later.<\/p>\n<p>Next, prepare the GAS environment. Create a GAS project bound to a spreadsheet.<\/p>\n<ol>\n<li>Create a spreadsheet<\/li>\n<li>Rename the sheet tab (Sheet1) to &#8220;gemini&#8221;<\/li>\n<li>Open Apps Script from the Extensions menu<\/li>\n<li>Under Services, add the Agent Platform API with the identifier &#8220;VertexAI&#8221; (Note: It is listed under &#8220;A&#8221;)\n<ul>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/add-service.png\" alt=\"Open the selection screen from &quot;Services&quot;\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/select-service.png\" alt=\"Selecting &quot;Agent Platform API&quot; in the advanced services (the ID is VertexAI, though)\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/seek-a.png\" alt=\"It is sorted under &quot;A&quot;, not &quot;V&quot;\" \/><\/li>\n<\/ul>\n<\/li>\n<li>Add a script file from &#8220;File&#8221; and name it &#8220;main&#8221;<\/li>\n<li>Paste the code (see <a href=\"#code\">Code<\/a> below)<\/li>\n<li>Set <code>PROJECT_ID<\/code>, <code>REGION<\/code>, and <code>MODEL_NAME<\/code> in the script properties <img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/set-script-property.png\" alt=\"Setting the script properties\" \/><\/li>\n<li>Reload the spreadsheet<\/li>\n<li>Enter your prompts for Gemini in cells A2 and A3 <img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/sheet-input.png\" alt=\"Example of sheet input\" \/><\/li>\n<\/ol>\n<p>The most important point of this article is to note that <strong>the service is sorted under &#8220;A&#8221;<\/strong> (as &#8220;Agent Platform API&#8221;). When the GAS advanced service was first announced, it was listed as &#8220;Vertex AI API&#8221; (cf. https:\/\/officeforest.org\/wp\/wp-content\/uploads\/2026\/01\/G-i51rQbQAEbb1O.webp), but as of 2026-08-16, it has been renamed to &#8220;(Gemini Enterprise) Agent Platform API&#8221;. This was the primary motivation for writing this article. The service may be renamed again in the future, and its alphabetical position in the list may shift accordingly, so please keep this in mind.<\/p>\n<h3>How to Run<\/h3>\n<p>The <code>onOpen<\/code> function adds a custom menu to the spreadsheet.<\/p>\n<p>Reload the spreadsheet.<\/p>\n<ol>\n<li>A menu is added; select it <img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-menu.png\" alt=\"Menu on the sheet\" \/><\/li>\n<li>Grant the required permissions when prompted (first run only)\n<ul>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-1.png\" alt=\"Authorization required\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-2.png\" alt=\"Review the app\" \/><\/li>\n<li><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-3.png\" alt=\"Go to the app\" \/><\/li>\n<\/ul>\n<\/li>\n<li>If an authorization warning popup appears, proceed through it<br \/>\n<img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/gas-auth-4.png\" alt=\"Continue popup\" \/><\/li>\n<li>Select your account and click &#8220;Continue&#8221; \/ &#8220;Allow&#8221; in the bottom right<\/li>\n<li>The output cells (B2, B3) will be populated with Gemini&#8217;s responses<br \/>\n<img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2026\/08\/sheet-filled.png\" alt=\"Sheet cells populated\" \/><\/li>\n<\/ol>\n<h3>Code<\/h3>\n<p>In this sample code, prompts written in cells A2 and A3 of the sheet are passed to the Gemini API, and the results are output to cells B2 and B3.<\/p>\n<p>The same file is available in the GitHub repository at <a href=\"https:\/\/github.com\/takotakot\/misc\/blob\/main\/gas_vertexai_gemini\/dist\/index.js\">gas_vertexai_gemini\/dist\/index.js<\/a>, so please refer to it as well.<br \/>\nThere is also a TypeScript version in a project initialized with <a href=\"https:\/\/github.com\/google\/aside\">ASIDE<\/a> (a development framework for GAS), so if you prefer to write in TypeScript, please refer to that.<\/p>\n<p>Similar sample code is also introduced in the official documentation and the following articles:<\/p>\n<ul>\n<li><a href=\"https:\/\/developers.google.com\/apps-script\/advanced\/vertex-ai\">Vertex AI Service<\/a><\/li>\n<li><a href=\"https:\/\/officeforest.org\/wp\/google-apps-script%E3%81%ABvertex-ai-service%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F\/#i-7\">Standard request<\/a> (immediately after, methods for making requests with attachments and for calling Claude 4 are also introduced!)<\/li>\n<\/ul>\n<pre><code class=\"language-javascript\">function callVertexAiGenerateContent(prompt) {\n  const scriptProperties = PropertiesService.getScriptProperties();\n  const projectId =\n    scriptProperties.getProperty('PROJECT_ID') ??\n    scriptProperties.getProperty('projectId') ??\n    '';\n  const region =\n    scriptProperties.getProperty('REGION') ??\n    scriptProperties.getProperty('region') ??\n    'global';\n  const modelName =\n    scriptProperties.getProperty('MODEL_NAME') ??\n    scriptProperties.getProperty('modelName') ??\n    'gemini-3.7-flash';\n  if (!projectId) {\n    throw new Error('Project ID is not configured in Script Properties.');\n  }\n  const model = `projects\/${projectId}\/locations\/${region}\/publishers\/google\/models\/${modelName}`;\n  const payload = {\n    contents: [\n      {\n        role: 'user',\n        parts: [\n          {\n            text: prompt,\n          },\n        ],\n      },\n    ],\n  };\n  const response = VertexAI.Endpoints.generateContent(payload, model);\n  return (\n    response?.candidates?.[0]?.content?.parts?.[0]?.text ??\n    'No response from Gemini API'\n  );\n}\n\nfunction runGeminiAPI() {\n  const sheet = SpreadsheetApp.getActiveSheet();\n  const promptA2 = String(sheet.getRange('A2').getValue() ?? '');\n  if (promptA2) {\n    try {\n      const resultB2 = callVertexAiGenerateContent(promptA2);\n      sheet.getRange('B2').setValue(resultB2);\n    } catch (error) {\n      const message = error instanceof Error ? error.message : String(error);\n      console.error(`Failed to call Vertex AI: ${message}`);\n    }\n  }\n  const promptA3 = String(sheet.getRange('A3').getValue() ?? '');\n  if (promptA3) {\n    try {\n      const resultB3 = callVertexAiGenerateContent(promptA3);\n      sheet.getRange('B3').setValue(resultB3);\n    } catch (error) {\n      const message = error instanceof Error ? error.message : String(error);\n      console.error(`Failed to call Vertex AI: ${message}`);\n    }\n  }\n}\n\nfunction onOpen() {\n  const ui = SpreadsheetApp.getUi();\n  ui.createMenu('Gemini')\n    .addItem('Read sheet and invoke Gemini API and write', runGeminiAPI.name)\n    .addToUi();\n}\n<\/code><\/pre>\n<h2>Notes<\/h2>\n<p><code>generativelanguage.googleapis.com<\/code> and <code>aiplatform.googleapis.com<\/code> are two distinct endpoints. The former is the Gemini API used from Google AI Studio and similar tools, and is mainly accessed using an API key (while setting up OAuth2 is possible, it is fairly cumbersome).<\/p>\n<p>On the other hand, <code>aiplatform.googleapis.com<\/code> evolved from AI Platform API to Vertex AI API, and was further renamed to Gemini Enterprise Agent Platform API. This can be called using GAS&#8217;s built-in authentication, completely eliminating the need to configure custom OAuth2 flows or manage API keys. Articles such as <a href=\"https:\/\/zenn.dev\/west_river\/articles\/gas-vertex-ai-image-analyzer\">Building an image analysis script with GAS \u00d7 Vertex AI (Gemini)<\/a> and <a href=\"https:\/\/zenn.dev\/ohimusdev46301\/articles\/84f8cf5feaa6f6\">No API key needed! Calling Gemini from GAS with OAuth authentication<\/a> describe methods using <code>UrlFetchApp<\/code>, but with the advanced service, even <code>UrlFetchApp<\/code> is unnecessary. (Note: While calling it via an API key is technically possible, that method is omitted here.)<br \/>\nPlease do take advantage of calling it <strong>without<\/strong> using <code>UrlFetchApp<\/code>.<\/p>\n<p>I looked into how <code>VertexAI.Endpoints.generateContent(payload, model)<\/code> maps to the standard Google Cloud client libraries \/ SDK methods, but could not find a direct 1-to-1 counterpart in the documentation.<\/p>\n<p>The REST API references are as follows:<br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest<\/a><br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest#rest-resource:-v1.projects.locations.endpoints\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest#rest-resource:-v1.projects.locations.endpoints<\/a><br \/>\n<a href=\"https:\/\/ai.google.dev\/api\/all-methods?hl=ja#service-endpoint\">https:\/\/ai.google.dev\/api\/all-methods?hl=ja#service-endpoint<\/a><\/p>\n<p>As of 2026-08-16, the Interactions API still appears to be under active development on the Vertex AI (Gemini Enterprise Agent Platform) side. I plan to write a follow-up article once it becomes available.<br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/models\/interactions-api\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/models\/interactions-api<\/a><br \/>\n<a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\/v1beta1\/projects.locations.interactions\">https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\/v1beta1\/projects.locations.interactions<\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>This article explained how to call Vertex AI Gemini (Gemini Enterprise Agent Platform API) using the advanced service in GAS (Google Apps Script).<\/p>\n<p>Without resorting to manual HTTP requests via <code>UrlFetchApp<\/code>, cumbersome OAuth2 setup, or API key management, you can call Gemini safely and intuitively with just a few lines of code simply by enabling the advanced service.<\/p>\n<p>The most important caveat is that, because the advanced service was renamed to <strong>Agent Platform API<\/strong>, it is now sorted under <strong>&#8220;A&#8221;<\/strong> in the Services list (even though the default identifier remains <code>VertexAI<\/code>).<\/p>\n<p>Because integration between Google Workspace products \u2014 starting with Spreadsheets \u2014 and Gemini has become easier than ever, I encourage you to try it out following the steps in this article.<\/p>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"https:\/\/developers.google.com\/apps-script\/release-notes#January_12_2026\">Google Apps Script Release Notes (January 12, 2026)<\/a><\/li>\n<li><a href=\"https:\/\/developers.google.com\/apps-script\/advanced\/vertex-ai\">Google Apps Script Advanced Services &#8211; Vertex AI Service<\/a><\/li>\n<li><a href=\"https:\/\/officeforest.org\/wp\/google-apps-script%E3%81%ABvertex-ai-service%E3%81%8C%E8%BF%BD%E5%8A%A0%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F\/\">Vertex AI Service added to Google Apps Script &#8211; Office Forest<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/takotakot\/misc\/blob\/main\/gas_vertexai_gemini\/dist\/index.js\">GitHub: takotakot\/misc (sample code)<\/a><\/li>\n<li><a href=\"https:\/\/docs.cloud.google.com\/gemini-enterprise-agent-platform\/reference\/rest\">Gemini Enterprise Agent Platform API REST Reference<\/a><\/li>\n<li><a href=\"https:\/\/zenn.dev\/west_river\/articles\/gas-vertex-ai-image-analyzer\">Building an image analysis script with GAS \u00d7 Vertex AI (Gemini) &#8211; Zenn<\/a><\/li>\n<li><a href=\"https:\/\/zenn.dev\/ohimusdev46301\/articles\/84f8cf5feaa6f6\">No API key needed! Calling Gemini from GAS with OAuth authentication &#8211; Zenn<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Vertex AI \u306e Gemini \u3092 GAS (Google Apps Script) \u304b\u3089\u547c\u3073\u51fa\u3059 English follows Japanese. \u6982\u8981 \u4e3b\u306a\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e4\u70b9\u3067\u3042\u308b\u3002 GAS \u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[7,28,13],"tags":[],"class_list":["post-749","post","type-post","status-publish","format-standard","hentry","category-google","category-google-apps-script-gas","category-google-cloud"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4dIdP-c5","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts\/749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/comments?post=749"}],"version-history":[{"count":2,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts\/749\/revisions"}],"predecessor-version":[{"id":762,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts\/749\/revisions\/762"}],"wp:attachment":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/media?parent=749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/categories?post=749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/tags?post=749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}