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 use the function use chrome version 81.0.4044.138(Official Build)
and who cannot use the function , chrome version 83.0.4103.61(Official Build)
(right-click and [save as] works fortunately)
I want to know what should I do to make one-click download function active again.
Script is as follows.
/**
* Adds a custom menu
*
* @param {Object} e The event parameter for a simple onOpen trigger.
*/
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu('Custom')
.addItem('Download as XLSX', 'downloadXLS_GUI')
.addToUi();
}
/**
* Display a modal dialog with a single download link.
*
* From: http://stackoverflow.com/a/37336778/1677912
*/
function downloadXLS_GUI() {
// Get current spreadsheet's ID, place in download URL
var ssID = SpreadsheetApp.getActive().getId();
var URL = 'https://docs.google.com/spreadsheets/d/'+ssID+'/export?format=xlsx';
// Display a modal dialog box with download link.
var htmlOutput = HtmlService
.createHtmlOutput('<a href="'+URL+'">Click to download</a>')
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setWidth(800)
.setHeight(600);
SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Download XLS');
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…