I use Google Apps Script to make download Spreadsheet data quickly.
Since several days before, download function doesn\'t work suddenly. Some of my coworkers who can
Problem
Cannot download a file via link in modal dialog
Reason
The ability to do so is deprecated since Chrome 83 (hence the issue). Modal dialogs are sandbox environments, therefore your script stopped working. If you open the developer tools (press f12
), you will see a warning:
Download is disallowed. The frame initiating or instantiating the download is sandboxed, but the flag ‘allow-downloads’ is not set. See https://www.chromestatus.com/feature/5706745674465280 for more details.
Adding a download
attribute to the link mitigates that part, but you will encounter the second warning:
Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
What to do
As of now, there is an open issue regarding the matter, and it is promised that the allow-downloads
flag will be added to HtmlService.XFrameOptionsMode.ALLOWALL
- you can add the option to modal dialog via setXFrameOptionsMode
and look for the updates.