I've written a short script in the Google Apps Script online editor to read my Google Calendar events for a particular day and determine when I am available. The goal is to produce some text that I can copy into a scheduling email, like this:
- 1/6, 10:00-11:30am EST
- 1/6, 12:45-3:00pm EST
- 1/6, 4:00-5:30pm EST
I can log these lines and then view logs in the web interface, but the log entries have these awkward timestamps at the beginning that I have to remove manually after copying. For example:
- [19-01-04 21:51:48:835 PST] 1/6, 10:00-11:30am EST
- [19-01-04 21:51:48:836 PST] 1/6, 12:45-3:00pm EST
- [19-01-04 21:51:48:836 PST] 1/6, 4:00-5:30pm EST
As a workaround, I would like my script to write the lines to a text file and then download this file to my computer. Answers to similar questions, such as this one, involve SpreadsheetApp objects (I'm using the Calendar, not Sheets, API) and creating UI elements (I'd like to do this without a UI). Can I trigger such a download directly in the script?