I've come across a few scripts to use with Google Sheets that will let me export a single sheet to a file on my Google Drive. However, instead of sending it there, I want it to download to my computer directly.
I'm looking to replace this...
DriveApp.createFile()
... with something else that will send the file, with a customized name, as a file to download in my browser.
Alternatively, You can use the anchor tag to download to local drive with a custom name:
Flow:
Snippet:
If my understanding is correct, how about this sample script? This sample script supposes the following points.
Sample script:
When you use this script, please copy and paste this script to the script editor. Script is the container-bound script of Spreadsheet. When you run
downloadSheetAsPDF()
, a dialog is opened on the Spreadsheet. Please check it. When you click the button, the PDF file is downloaded.Note:
var sheetId = ss.getSheetByName("sheetName").getSheetId();
.References:
If this was not the result you want, I apologize.
Edit:
If my understanding is correct, how about this sample script? The flow of this sample script is as follows. I think that there might be several answers for your situation. So please think of this as just one of several answers.
Sample script: