Error when trying to remove strings in a gsheets column

8 views Asked by At

I'm trying to remove the same string of rows from the same column in gsheet. I'm coding in App Script. In theory, in my code, each row is tested whether it has the string, if so it should remove it. however, it's giving an error.

function removeStrings() {

var spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
var sheet = spreadsheet.getSheetByName('Dataset')

for (var i = 0; i \< 162; i++) {

    var num = i + 50
    var row = sheet.getRange(num,5)
    var value = row.getValue()
    var length = value.length
    var first = value[0]
    var last = value[length - 1]
    
    if ((first == '{') && (last == '}')) {
      
      var string = value.replace('{"Description": ', '')
    
      row.setValues(string)
    
      var string2 = value.replace('}', '')
    
      row.setValues(string2)
    }

}

However, it's giving this error: "Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Range.setValues." in line 20.

0

There are 0 answers