This is my first ever attempt with Apps Script and I'm trying to save a Google Spreadsheet as a csv file on Google Drive in a specific folder for archiving purposes. The "Checkout" sheet is one of several sheets in the Spreadsheet that contains a summary of the items that the client has requested. The sheet would include a "Confirm" button that, if clicked, should save the Checkout sheet only in the clients folder as a csv file. I've written the code below, however, I keep getting the following error "ReferenceError: "convertRangeToCsvFile_" is not defined.".
Could anyone please help with this?
function completeCheckout() {
var coS = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Checkout");
var clientFolder = DriveApp.getFolderById("14obb1o2gZFWMaSXQ7QF_2SemydGXIVLX");
var clientName = "Client1";
var TimeStamp = Utilities.formatDate(new Date(), "GMT+2", "dd-MM-yyyy hh:mm:ss aaa");
var fileName = clientName + TimeStamp + ".csv";
var csvFile = convertRangeToCsvFile_(fileName,coS);
clientFolder.createFile(fileName, csvFile);
}