Apps Script公式リファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary


Google Slidesの表でセルを結合したい - merge cells in a table on Google Slides

Google Apps Scriptで、Google Slidesに配置されている表のセルを結合したくて書いたコードです。
I wrote Google Apps Script to merge cells in a table placed on Google Slides.

In this example, I will merge the third column of a 4-row, 3-column table.

Although you can achieve this manually by selecting the cells you want to merge, right-clicking, and choosing "Merge cells," this time I will try to do it using Apps Script.
function runMergeTableCells() {
var slide = SlidesApp.getActivePresentation();
var table = slide.getSlides()[0].getTables()[0];
var resource = {
mergeTableCells: {
objectId: table.getObjectId(),
tableRange: {
location: {
rowIndex: 0,
columnIndex: 2
rowSpan: 4,
columnSpan: 1
Slides.Presentations.batchUpdate(resource, slide.getId());


SlidesAppだけでは実現できないようなので、Google Slides APIを利用しました。
Since it seems impossible to achieve this with SlidesApp alone, I utilized the Google Slides API.

GeminiもChatGPTもGoogle Slides APIを利用するコードを提案してくれました。
Both Gemini and ChatGPT suggested using the Google Slides API to write the code.

Google Slides APIを利用するにはサービスの+ボタンから追加します。
To use the Google Slides API, we need to add it from the "+" button in the Services section.

サービス > Google Slides API > 追加
Services > Google Slides API > Add

By adding the Slides service, you will be able to use the Slides as ID.


Google Slides API > REST Resource: presentations

Latest post

Google Apps Scriptの障害時はIssueTrackerを見てみる - Incidents for Apps Script are reported on Issue Tracker

IssueTracker > Apps Script issues Google Apps Scriptの障害時は IssueTracker に課題が上がっていることが...