Google apps script 将谷歌工作表中的URL插入谷歌幻灯片演示文稿

Google apps script 将谷歌工作表中的URL插入谷歌幻灯片演示文稿,google-apps-script,google-slides-api,google-slides,Google Apps Script,Google Slides Api,Google Slides,我在google sheets文档中有一堆URL,我想在我当前的代码中引用它们,这样它们就会插入到google幻灯片演示文稿中 以下是我当前的代码: var NAME = ("Price Changes, Earnings Revisions and F-GPE"); var deck = SlidesApp.openById("1dKURl3umVd3A6M5fbbm1SY1W-NzaaCNW-5rPtTKuNYw"); var layoutslide = SlidesApp.openById

我在google sheets文档中有一堆URL,我想在我当前的代码中引用它们,这样它们就会插入到google幻灯片演示文稿中

以下是我当前的代码:

var NAME = ("Price Changes, Earnings Revisions and F-GPE");
var deck = SlidesApp.openById("1dKURl3umVd3A6M5fbbm1SY1W-NzaaCNW-5rPtTKuNYw");
var layoutslide = SlidesApp.openById("1dKURl3umVd3A6M5fbbm1SY1W-NzaaCNW-5rPtTKuNYw").getSlides()[2];
var layout = layoutslide.getLayout();
//var layoutname = layout.getLayoutName();
/**
* Creates a single slide using the image from the given link;
* used directly by foreach(), hence the parameters are fixed.
*
* @param {Date} link A String object representing an image URL
* @param {Date} index The index into the array; unused (req'd by forEach)
* Sets the desired images height and width
* Gets the images's height and width and centres the image
*/
function addImageSlide(imageUrl, index) {
var layout = layoutslide.getLayout();
//var layoutname = layout.getLayoutName();
var slide = deck.appendSlide(layout);
var image = slide.insertImage(imageUrl);
var setimgwdth = image.setWidth(700);  
var setimghght = image.setHeight(430);
var imgWidth = image.getWidth();
var imgHeight = image.getHeight();  
var pageWidth = deck.getPageWidth();  
var pageHeight = deck.getPageHeight();
var newX = pageWidth/2. - imgWidth/2.;
var newY = pageHeight/2. - imgHeight/2.;
image.setLeft(newX).setTop(newY);
}

/**
* The driver application features an array of image URLs, setting of the
* main title & subtitle, and creation of individual slides for each image.
*/
function main() {
var images = [
             "https://product.datastream.com/dscharting/gateway.aspx?guid=a82ade99-e810-463e-9b21-8380971a7488&action=REFRESH" ,
             "https://product.datastream.com/dscharting/gateway.aspx?guid=933e1953-fd5b-48d0-b9f5-28e9e6c5e01a&action=REFRESH" ,
             "https://product.datastream.com/dscharting/gateway.aspx?guid=9caf2c27-f5f3-4dfe-a784-3e964504dc03&action=REFRESH"

];
var [title, subtitle] = deck.getSlides()[0].getPageElements();
title.asShape().getText().setText("Price Changes, Earnings Revisions and F-GPE");
subtitle.asShape().getText().setText("SA INSPIRATION LIST");
images.forEach(addImageSlide);
}
是否有一种方法可以自动在URL中添加引号和逗号。

您可以做的是:

  • 打开要使用的电子表格,并使用它获取数据

  • 将数据放入某个变量后,现在可以打开活动幻灯片并使用发布内容
  • 使用幻灯片API中的setText时:


    setText(使用GETRANGE的电子表格数据)

    你是什么意思?