all, my purpose is to download a spreadsheet file as local csv file. And after some test, I now come to the solution use the doGet() as below:
function doGet(){
...
var output = ContentService.createTextOutput().setContent(csvOriFile).downloadAsFile(fileName);
return output;
}
The csv file can be downloaded using the url as below in the browser: https://script.google.com/macros/s/AKfycby45YEyOpgBruiq1DBa4A2eBAXau8EH.../exec"
As I want to set it as a weekly auto-fetched process, I want to write a bash script to run the url to get the csv file. But I do not know how to do this. As this also related to gmail authentication. I searched some solutions, seems this link is what I want, but that question also got no answers. I tried to run and modify that script, use curl to do authentication first, and then use curl to fetch the file, but failed. Can anyone help? Thanks
Solution: I later used google drive API to do the work.