merge values in column in a row with the quotes separator “|”, based on a comparison with the values of another column

前端 未结 2 629
有刺的猬
有刺的猬 2021-01-16 12:21

as the title suggests I\'m trying to find a way to treat some data in a spreadsheet to google app. I think the best way is to directly set an example and thank you in advan

2条回答
  •  时光说笑
    2021-01-16 12:45

    Here is a code that does exactly what you expected using a simple loop and a comparison.

    function merge_col() {
      var ss = SpreadsheetApp.getActive().getSheetByName('sheet1');
      var data = ss.getDataRange().getValues();
      var header = data.shift();
      var col1 = data[1][0];
      var col2 = '';
      var col3 = '';
      var dataSheet2 = [header];
      for(var i=0 ; i

提交回复
热议问题