This script is to convert the Google Sheets data into CSV file, then store the data into Google Drive folder.
Script is licensed as MIT license.
If you liked to use this script on your project, you will have to edit these parameters in order to compatible with your file and folder access.
- File ID
This is the file ID that the new CSV will override.
To retrive the file ID value, use the retrieve all file function.
try {
var file = DriveApp.getFileById("1vNB3Wfm919gXdTLbbonpuKaHcOZ__v88");
file.setContent(csv);
- Folder ID (optional)
This is the folder that the file will locate. If there is none, the script could work, but when there is no file that is ID as the same asFile ID
, this folder will be the location that the new file will be created.
Please make sure that there is a validFile ID
that the script can access.
// catch when there is no file in the folder
var folder = DriveApp.getFolderById("1tTo0PRIkVjbyk5JJoEz-FMzf3JKm8udP");
folder.createFile("File.csv", csv);
This script is part of Cooperative Studies at King Mongkut Institute of Technology Ladkrabang.