I have this code to export my Google sheets to a 'CSV' delimited tab "|" thanks to the help @iansedano.
So this is the script:
function createCsvContent(values, delimiter) {
// This converts the values 2D array into a simple array of strings delimited by the delimiter
const stringArray = values.map(row => row.join(delimiter))
// Then it joins all the strings with newlines
const output = stringArray.join("\n")
return output
}
function createCsv() {
// Get all the values from the sheet as a 2D array
const file = SpreadsheetApp.getActive();
const sheet = file.getSheetByName("LIST");
const range = sheet.getDataRange();
const values = range.getValues();
// call the function to create the csv-like content
const csvContent = createCsvContent(values, "|")
// create the file in drive
//DriveApp.createFile('csvFile', csvContent, MimeType.PLAIN_TEXT)
DriveApp.getFileById("[10eI7WAO688nQHRqj7ymscN5I5fJpP4fVTUn_qZMuq3Y]").setContent(csvContent)
}
So each time I run the script, I want to overwrite this file https://docs.google.com/document/d/10eI7WAO688nQHRqj7ymscN5I5fJpP4fVTUn_qZMuq3Y/edit.
I cant file the proper File ID of this. If i am not wrong, this is not the file ID '10eI7WAO688nQHRqj7ymscN5I5fJpP4fVTUn_qZMuq3Y'.
Where i can get the real ID of the Google Doc?