CSV file created by app script has a problem

30 Views Asked by At

I have the following code in my app script application:

  ...

  // Create CSV content
  var csvContent = "Beneficiário*,Conta/IBAN*,Tipo*,Informação complementar,Montante*,Email de Notificação\r\n";
  data.forEach(function(row) {
    csvContent += row.join(",") + "\r\n";
  });

  // Create and save CSV file in the same folder as the spreadsheet
  var csvFile = folder.createFile("MapaPagamentos.csv", csvContent, MimeType.CSV);

This works well and generates my CSV file.

I then import it into a program, which does NOT read the file.

If I open Excel and do "import data" from the CSV file, use "," as the separator and UTF-8 encoding, saving the resultant file, it works (meaning the second program reads the data well).

The question is how to "simulate" this process in the code, without having to use Excel?

Thanks

0

There are 0 best solutions below