Google App Script Snippet

Use this App Script snippet to import CSV Getter data into a Google Sheet. You can set Scheduled Google App Script triggers to have a regular backup of your data.

function csvGetter() {

// URL of the CSV file [REPLACE WITH YOURS]

var url = "<YOUR EXPORT URL>";

// Fetch the CSV file

var response = UrlFetchApp.fetch(url);

// Get the contents of the file as a string

var csvString = response.getContentText();

// Convert the CSV string to a 2D array

var csvData = Utilities.parseCsv(csvString);

// Get the active sheet

var sheet = SpreadsheetApp.getActiveSheet();

// Clear the existing data in the sheet

sheet.clear();

// Write the data from the CSV file to the sheet

sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);

}

Last updated