title: use bash script to download csv file from a url generated by google app script
body: <p>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:</p>
  
  <pre><code>function doGet(){
  ...
  var output = ContentService.createTextOutput().setContent(csvOriFile).downloadAsFile(fileName);
  return output;
  }
  </code></pre>
  
  <p>The csv file can be downloaded using the url as below in the browser:
      <a href="https://script.google.com/macros/s/AKfycby45YEyOpgBruiq1DBa4A2eBAXau8EH.../exec" rel="nofollow noreferrer">https://script.google.com/macros/s/AKfycby45YEyOpgBruiq1DBa4A2eBAXau8EH.../exec</a>"</p>
  
  <p>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 <a href="https://stackoverflow.com/questions/14671573/google-app-scripts-curl-authorization">link</a> 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</p>
  
  <p>Solution:
  I later used google drive API to do the work.</p>