小编Dan*_*ard的帖子

Google Apps 脚本在数组中查找值

我不知道如何检查数组中是否存在值。我认为这应该非常简单,但无法实现。

我有这个代码:

function findPlayer() {
 //This section gets the values from the first row of all the columns
 var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Players");
 var lastColumn = ss.getLastColumn()
 var playerNameRow = ss.getRange(1, 2, 1, lastColumn - 3); 
 var playerNameValues = playerNameRow.getValues(); 

 //This just sets the value we're looking for (which in this example is in the 7th Column "G"). And logs the Array, just to check it.
 var findPlayer = "Dan";
 Logger.log(playerNameValues)


 //and here we just loop through the playerNameValues array looking …
Run Code Online (Sandbox Code Playgroud)

google-apps-script

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

Google App脚本在日期中添加一天

我不知道如何在Google App脚本中为日期添加一天。我有这个脚本:

function dateTest() {

var testDate = new Date();
var secondDate = new Date(testDate.getDate()+1);

 Logger.log(testDate);
 Logger.log(secondDate);
}
Run Code Online (Sandbox Code Playgroud)

产生以下日志:

[16-11-30 16:35:02:499 GMT] 2016年11月30日星期三16:35:02 GMT + 00:00 2016

[16-11-30 16:35:02:500 GMT]星期四1月1日01:00:00 GMT + 01:00 1970

我不明白为什么不加上日期?

google-apps-script

1
推荐指数
3
解决办法
1万
查看次数

标签 统计

google-apps-script ×2