I am trying to figure out how can I export the text from a specific column from Google Sheets to a Google Drive .txt file. I am trying to export all the text from all the columns so there would be a different .txt file on google drive for each column. Also would want to skip first 2 rows. I found this:
function saveToTextfile() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getActiveSheet();
var range = sheet.getRange(1, 1, sheet.getLastRow(), sheet.getLastColumn());
var rows = range.getValues();
var folder = DriveApp.getFoldersByName("folderName").next();
var files = folder.getFiles();
while(files.hasNext()) files.next().setTrashed(true);
rows.forEach(function(row, index) {
folder.createFile("row" + index + ".txt", row.join(", "));
});
}
This function is doing a text file for all the rows instead of columns and also adds a lot of "," in the resulted txt file. I can't figure it out how to change so it will do the columns, basically I want the function to create a txt file for columns (example: D3 to D100, E3 to E100, F3 to E100 and so on). Also want this to update the text files when any changes are made on the sheet.
Thanks :)