0

I'm importing a CSV in Google Sheet with the following code:

function testf() {
  var response = UrlFetchApp.fetch("http://caricamento/user.csv");
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var cell = ss.getRange("DB DEFINITVO!K1:L");
  cell.setNumberFormat('@STRING@');
  var cell2 = ss.getRange("DB DEFINITVO!C1:C");
  cell2.setNumberFormat('@STRING@');
  var dest = ss.getSheetByName("DB DEFINITVO");
  var sheetId = dest.getSheetId();

  var reqs = [
    { pasteData: { data: response.getContentText(), delimiter: ",", coordinate: { sheetId } } },
    { findReplace: { find: "NULL", replacement: "", sheetId } }
  ];
  Sheets.Spreadsheets.batchUpdate({ requests: reqs }, ss.getId());
}

enter image description here

The rows are populated with these: symbols � I don't recognise. How I delete these symbols?

Rubén
  • 34,714
  • 9
  • 70
  • 166
Franco DF
  • 31
  • 4
  • You may want to try [Utilities.parseCsv()](https://developers.google.com/apps-script/reference/utilities/utilities#parsecsvcsv). – doubleunary Sep 30 '22 at 09:04

1 Answers1

0

Try specifying the character set to use, as in response.getContentText('UTF-8').

doubleunary
  • 13,842
  • 3
  • 18
  • 51