【发布时间】:2020-02-01 02:00:03
【问题描述】:
所以我目前正在开发一个函数来使用应用脚本 api 格式化 Google 表格上的一些输入单元格。
现在我正在从几个单元格中获取输入并稍微格式化它们以符合手动生成的系统。
一个单元格是一个学校名称单元格。有时这些名称往往很长,我在 javascript 方面不是超级经验,但现在我正在从一个单元格中获取一个参数,我将如何定义该参数的变量,以便它只接受单元格中直到第二个空格的所有内容。
前:
单元格 A#:填空高中联盟
输出:高位填空
/**
*Generates a Trip Key
*
*@param DateColumn Date
*@param SchoolColumn School name
*@param LocationColumn Location
*@customfunction
*/
function GENERATEKEY(DateColumn, SchoolColumn, LocationColumn) {
var DateConver = Utilities.formatDate(DateColumn, SpreadsheetApp.getActive().getSpreadsheetTimeZone(), "MM.dd.yyyy");
var SchoolClean = SchoolColumn.replace(
return DateConver + " " + SchoolColumn + " " + "@" + " " + LocationColumn
}
【问题讨论】:
标签: javascript string google-apps-script google-sheets custom-function