如何在Google Spreadsheet中返回以逗号分隔的单元格区域字符串? [英] How to return comma-delimited string of range of cells in Google Spreadsheet?

查看:140
本文介绍了如何在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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆