如何在Google Spreadsheet中返回以逗号分隔的单元格区域字符串? [英] How to return comma-delimited string of range of cells in Google Spreadsheet?
问题描述
我正在使用Google电子表格。我正在编写一个自定义函数,它将一系列单元格作为参数,并返回一个字符串,用于为单元格的内容添加一个分隔逗号。
例如,我们有一个范围 B1:B2
,其中单元格B1包含B1_contents
,单元格B2包含 B2_contents
。该函数应该返回B1_contents,B2_contents
。
Google电子表格中如何使用google-apps javaScript?
非常感谢您的帮助。 您可以尝试以下操作:
function rangeToStringSep(range, sep){
return range.toString()。split(',')。join(sep);
}
使用:
= rangeToStringSep(B1:B3;,)
UPDATE
$ b
function rangeToStringSep1(range ,sep){
return range.join(sep);
}
I am using Google spreadsheet. I am writing a custom function that takes in a range of cells as parameter and returns a string that adds a delimiting comma to the contents of the cell.
For example, we have a range B1:B2
where cell B1 contains "B1_contents"
and cell B2 contains "B2_contents"
. The function should return "B1_contents, B2_contents"
.
How can this be done in Google spreadsheet using google-apps javacript?
Thank you very much for your help.
You can try the following:
function rangeToStringSep(range, sep) {
return range.toString().split(',').join(sep);
}
Use:
=rangeToStringSep(B1:B3; ", ")
UPDATE
function rangeToStringSep1(range, sep) {
return range.join(sep);
}
这篇关于如何在Google Spreadsheet中返回以逗号分隔的单元格区域字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!