Apps Script splite array

យើងមានទិន្ន័យជា Array ហើយនៅក្នុងធាតុនីមួយមានច្រើនទិន្ន័យដោយយើងចង់បំបែកវា រួចហើយយើងចង់បន្ថែមអក្សរទៅវានីមួយៗ មន្ទាបមកយើងប្រើ join method ដើម្បីបោះឲ្យវាចូលធាតុនីមួយៗវិញ

function myFunction() {
  var sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
  let s = sh.getRange(1,1,107,1).getValues()
  let b = []
  for(i of s){
    b.push(i)
  }
  // console.log(b.length)

for(i= 52; i<b.length; i++){
  let t = b[i]
  // console.log(t)
  let p = ""
    t.map(function(e){
      p =e
    })
  //  console.log(p)
   let n =  p.split(" ")
   let arrN = []
   n.forEach(function(e){
      let b = "b"+e
      arrN.push(b)
   })
  //  console.log(arrN.join())
  
  sh.getRange(i+1,2).setValue(arrN.join())

}
  
}

Post a Comment

0 Comments