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

2024年5月13日月曜日

Google Slidesで現在開いているスライドのIDを取得したい - Get current slide ID


GoogleスライドをApps Scriptで操作する際に、slideIdの取得が必要になったので試してみました。
I tried to get the slide Id via Google Apps Script on Google Slides.



Code.gs
function getCurrentSlideId() {
var presentation = SlidesApp.getActivePresentation();
var selection = presentation.getSelection();
var pageElement = selection.getCurrentPage();
var slide = pageElement.asSlide();
var slideId = slide.getObjectId();
Logger.log(slideId);
}



Tips

Geminiに質問して得た回答をコンパクトにしたのが、上記の Code.gs です。
The Code.gs above is a compact version of the answer I got from Gemini.



Get current slide ID in Google Slides using Apps Script.

Latest post

スプレッドシートの空白セルを直前の値で埋めたい

A列の空白セルに直前の値を入れたくて書いたコードです スプレッドシートに以下のようなBeforeの表があるとき (A列に空白セルがある) Before 1 A B 2 エリア 都市 3 東京 新宿 4 渋谷 5 池袋 6 神奈川 横浜 7 川崎 8 相模原 9 千葉 千葉 10 ...