'Getting garbage loading a csv file into a google sheet using google script
I'm trying to load a csv file into a Google Sheet and getting garbage. I'm using a csv file that looks like this in Notepad:
"Month", "1958", "1959", "1960" "JAN", 340, 360, 417 "FEB", 318, 342, 391 "MAR", 362, 406, 419 "APR", 348, 396, 461
I've tried a few different snippets of code and get the same garbage. Here's the latest code that I'm using:
function appendCSV() {
var file = DriveApp.getFilesByName("airtravel.csv").next();
var csvData = Utilities.parseCsv(file.getBlob().getDataAsString(),',');
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow=sheet.getLastRow();
sheet.getRange(lastRow, 1, csvData.length, csvData[0].length).setValues(csvData);
}
Here are the first few lines of the garbage that I'm getting in the google sheet (this web page wouldn't accept more... thought it was un-indented code)
%PDF-1.4 % ���� 4
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
