-1

我在谷歌表格文档中有一堆 URL,我想在我当前的代码中引用它们,以便它们随后插入到谷歌幻灯片演示文稿中。

这是我当前的代码:

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);
}

有没有办法自动在网址中添加引号和逗号。

4

1 回答 1

0

你可以做的是:

  1. 使用openById打开要处理的电子表格并使用getRange获取数据。

    1. 将数据放入某个变量后,您现在可以打开活动幻灯片并使用setText发布内容

从 Slides API 使用 setText 时:

setText(SPREADHSHEET_DATA_USING_GETRANGE);

于 2018-03-27T12:03:35.933 回答