Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

App Script: Cell to Row then Cell to column

$
0
0

There's a way to add column and add data after we split from cell to column using app script?

Currently I split my cell to a new rowfrom this

| left | 2023-03-21 15:38:20 ||

to thisenter image description here

using this code

function result(range) {  delimiter = "\n"  targetColumn = 4  var output2 = [];  for(var i=0, iLen=range.length; i<iLen; i++) {    var s = range[i][targetColumn].split(delimiter);        for(var j=0, jLen=s.length; j<jLen; j++) {      var output1 = [];       for(var k=0, kLen=range[0].length; k<kLen; k++) {        if(k == targetColumn) {          output1.push(s[j]);        } else {          output1.push(range[i][k]);        }      }      output2.push(output1);    }      }  return output2;}

Now I want to achieve this, to split the data using columns and no get some values (total)

enter image description here


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>