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


Google Slidesの表にSpreadsheetから値を入れたい - Insert Spreadsheet values into a Slides table

In a previous article, I created a dialog on a slide and used it to input values into a table.

This time, I tried retrieving values from a spreadsheet and inserting them into a table in a slide.

Insert the values from range B2:E5 in the Sheet into the Slides table.

Place a 5x5 table on the slide.

Insert the values starting at the second row and second column of the table.←
function setValuesToSlideFromSheet() {
const sheetUrl = "";
const slideUrl = "";

const sheet = returnSheet(sheetUrl);
const startRow = 2;
const startCol = 2;
const numRows = 4;
const numCols = 4;
const range = sheet.getRange(startRow, startCol, numRows, numCols);
const values = range.getValues();

const page = returnPage(slideUrl);
const table = page.getTables()[0];
setValuesInTable(table, values, 1, 1);

function returnSheet(sheetUrl) {
const spreadsheet = SpreadsheetApp.openByUrl(sheetUrl);
const sheetId = sheetUrl.split("/edit#gid=")[1];
const sheets = spreadsheet.getSheets();
for (let i = 0; i < sheets.length; i++) {
if (sheets[i].getSheetId() == sheetId) {
return spreadsheet.getSheets()[i];

function returnPage(slideUrl) {
const slide = SlidesApp.openByUrl(slideUrl);
const slideId = slideUrl.split("/edit#slide=id.")[1];
const pages = slide.getSlides();
for(let i = 0; i < pages.length; i++) {
if(pages[i].getObjectId() == slideId) {
return slide.getSlides()[i];

function setValuesInTable(table, values, startRow = 0, startCol = 0) {
for (var row = 0; row < values.length; row++) {
for (var col = 0; col < values[row].length; col++) {
if (row + startRow < table.getNumRows() && col + startCol < table.getNumColumns()) {
table.getCell(row + startRow, col + startCol).getText().setText(values[row][col]);

sheetUrlとslideUrlを書き換えて、setValuesToSlideFromSheet()を実行すると、startRow, startCol, numRows, numCols で設定した範囲内にあるシートの値がSlideの表に入力されます。
After changing sheetUrl and slideUrl in and executing setValuesToSlideFromSheet(), the values within the sheet range specified by startRow, startCol, numRows, and numCols will be inserted into the table on the Slide.


The data in this example was generated by Gemini.

1. 日本語訳
2. Part of Speech: v. adv. adj. など品詞の短縮形
3. short description: 短い一文の英文で説明してください。
OUTPUT例 それぞれ以下の形で一行で書いてください。
get: 得る: Part of Speech: Short description

get: 得る: v.: To obtain or receive something.
take: 取る: v.: To carry or move something from one place to another.
make: 作る: v.: To create or produce something.
give: 与える: v.: To offer or hand over something to someone.

A列にOUTPUTを貼り付けて、B列に=split(A2,": ",false)のような関数を入れるとB,C,D,E列に値が入ります。
By pasting the OUTPUT into column A and entering a function like =split(A2, ": ", false) in column B, the values will be split and placed into columns B, C, D, and E.


Google Apps Scriptでスライド内のページIDを取得したい(.getObjectId)

Google Slidesの表をApps Scriptで取得したい - Get tables in Slides

Google Slidesの表に値を入れたい Insert values into the specific table


Google Slidesのダイアログから表に値を入力したい - Input values from dialog to table

Google Slidesのダイアログから表に値を入力したい2 - Input values from dialog to table 2

Latest post

Google Slidesで現在選択している表に値を入れたい3 - Insert values into the active table3

Google Slidesで現在選択している表に値を入れたい2 - Insert values into the active table2 上記のリンク先では、値の数に応じて行を追加しました。 In the linked article above, rows were add...