Skip to content

Instantly share code, notes, and snippets.

@noahlearner
Created January 22, 2020 23:24
Show Gist options
  • Save noahlearner/eea2810789a00c3d2cf94efd740eab73 to your computer and use it in GitHub Desktop.
Save noahlearner/eea2810789a00c3d2cf94efd740eab73 to your computer and use it in GitHub Desktop.
//************************************************
//* This script is used to pull in Scheduled Screaming frog crawls
//************************************************
function doPost(e){
importCSVFromGoogleDrive();
}
function doGet() {
importCSVFromGoogleDrive();
}
function importCSVFromGoogleDrive() {
/* this should be only thing needed to be updated during build process */
/* replace xxxxs with the folder id. To do that browse to the drive folder where you want to store the file, and grab the id from the end of the url.
for URL https://drive.google.com/drive/u/1/folders/1sr09or7856RghNM67, replace the XXXXXXXXXs with 1sr09or7856RghNM67
var folder = DriveApp.getFolderById('xxxxxxxxxxxxxxxxxxxxxxx');
var file = folder.getFilesByName("custom_extraction_all.csv").next();
var csvData = Utilities.parseCsv(file.getBlob().getDataAsString());
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Crawl");
sheet.clear();
sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment