Answer the question
In order to leave comments, you need to log in
How to download a file using google apps script?
I have a Google spreadsheet with data and a script with which I generate an html file from the table, which I then want to download. How to do it?
Answer the question
In order to leave comments, you need to log in
There are several download options. As well as ways to create a file. It is not clear from the question how the file is created, what are the requirements for downloading, what interface is used.
Let's pretend that:
The main idea of exporting/downloading files from Disk is to get a link to a resource
var file = DriveApp.createFile(fileName, content, 'text/html');
var downloadUrl = file.getDownloadUrl();
// Создаем окно на клиенте и запускаем
var a = window.document.createElement('a');
a.href = downloadUrl;
a.text = 'Download';
document.body.appendChild(a);
a.click();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question