小编use*_*913的帖子

Google脚本 - 替换错误

我需要一种方法,使用Google Apps脚本将字符串的一部分替换为另一个字符串.我测试了以下内容并且它有效:

function test(){
  var value = 'https://plus.google.com/117520727894266469000';
  var googleimageURL = googlePlus(value);
  Logger.log('Returned Result: ' + googleimageURL);
}

function googlePlus(value){
    var apiKey = ScriptProperties.getProperty('apiKey');
    var re = 'http://'
    var theURL = value;
    Logger.log('Google+ is called: ' + value);
    var replacingItem = 'https://';
    var theURL = theURL.replace(re, replacingItem);
    Logger.log('Google+ Values 2: ' + value + ' : ' + theURL + ' after ' + replacingItem);
    return imageURL;
}
Run Code Online (Sandbox Code Playgroud)

但是,当我嵌入以下代码时,它无法正常工作.任何的想法?

  //If a Google+ column was not specified,put a flag.
  if (googleColumn …
Run Code Online (Sandbox Code Playgroud)

google-apps-script

4
推荐指数
1
解决办法
4632
查看次数

标签 统计

google-apps-script ×1