Created
November 13, 2023 00:52
-
-
Save bpwebs/991beff47882cb264625793e22a993d3 to your computer and use it in GitHub Desktop.
Combine CSV files with Google Apps Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function combineCsv() { | |
const folder = DriveApp.getFolderById("1MBaI_rGJ6t_loANMAvGpDbr2MeHZwxnn"); | |
const files = folder.getFilesByType(MimeType.CSV); | |
let combinedData = []; | |
while(files.hasNext()){ | |
let file = files.next(); | |
let csvData = Utilities.parseCsv(file.getBlob().getDataAsString()); | |
combinedData = combinedData.concat(csvData); | |
} | |
folder.createFile("Combined.csv", combinedData.join("\n"),MimeType.CSV); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment