Compare Sheet Data

18 views
Skip to first unread message

Michael Timpano

unread,
Mar 20, 2023, 4:00:32 PM3/20/23
to Google Apps Script Community
The following code below works, but I want to be able to compare data from two sheets but not include column E in the comparison part of the code, but be able to right the data from that column to the target sheet from the source sheet? Not sure if it is possible or not? Thanks in advance for this concern. Take care.

const sourceRange = source.getRange(2, 1, source.getLastRow() - 1, 17).getValues().filter(String)
  // console.log(sourceRange)

  const targetRange = target.getRange(2, 1, target.getLastRow() - 1, 17).getValues().filter(String)
  // console.log(targetRange)

  let acceptedList = targetRange.map( r => r.join(""))  
 
  sourceRange.forEach((r, i) => {
    if (!~acceptedList.indexOf(r.join(""))) {
      targetRange.push(r)
    }
  })
Reply all
Reply to author
Forward
0 new messages