我有一个电子表格,其中包含以下信息:
Columnn 1 Column 2
Event 1 00:00:00
Event 2 00:03:25
.
.
如果我使用此脚本:
function export() {
var folderName = "the folder";
var folder = DriveApp.getFoldersByName(folderName).next();
var name = SpreadsheetApp.getActive().getName();
var sheet = SpreadsheetApp.getActiveSheet();
var values = sheet.getDataRange().getValues();
var text = values.map(function (a) {return a.join(' ');}).join('\n');
var file = DriveApp.createFile(name+'.txt', text);
folder.addFile(file);
}
我有一个这样的文件:
Event 1 Sat Dec 30 1899 01:42:46 GMT-0300 (CLST)
Event 2 Sat Dec 30 1899 01:46:11 GMT-0300 (CLST)
.
.
但我希望这样:
Event 1 00:00:00
Event 2 00:03:25
.
.
我做错了什么?
答案 0 :(得分:1)
改为使用getDisplayValues()
:
var values = sheet.getDataRange().getDisplayValues();