'Importing CSV in plain Text for specific ranges
With this code I can import from a CSV to a Google Sheet.
I am trying, for the columns C, H, I, the possibility to import the data in plain text.
How could I proceed?
function testf() {
var response = UrlFetchApp.fetch("https://xxx.csv");
var ss = SpreadsheetApp.getActiveSpreadsheet();
var dest = ss.getActiveSheet();
SpreadsheetApp.flush();
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());
}
Solution 1:[1]
Just a simple example
function lfunko() {
let s = "abcdefghijklmn<";
Logger.log(s.split("").filter(c => c.match(/\w/)).join(""));//removes <
}
The complexity of the filter depends upon your data
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cooper |
