-
StackOverflow 文档
-
google-apps-script 教程
-
Google Web App 脚本从 Google 云端硬盘自动下载
-
forms.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
setInterval(
function ()
{
document.getElementById('messages').innerHTML = 'Event Timer Fetching';
google.script.run
.withSuccessHandler(onSuccess)
.withFailureHandler(onFailure)
.fetchFromGoogleDrive();
}, 60000);
function callFetchGoogleDrive() {
document.getElementById('messages').innerHTML = 'Fetching';
google.script.run
.withSuccessHandler(onSuccess)
.withFailureHandler(onFailure)
.fetchFromGoogleDrive();
}
function onSuccess(sHref)
{
if(new String(sHref).valueOf() == new String("").valueOf())
{
document.getElementById('messages').innerHTML = 'Nothing to download';
}
else
{
document.getElementById('messages').innerHTML = 'Success';
document.getElementById('HiddenClick').href = sHref;
document.getElementById('HiddenClick').click(); // Must enable Pop Ups for https://script.google.com
}
}
function onFailure(error)
{
document.getElementById('messages').innerHTML = error.message;
}
</script>
</head>
<body>
<div id="messages">Waiting to DownLoad!</div>
<div>
<a id="HiddenClick" href="" target="_blank" onclick="google.script.host.close" style="visibility: hidden;">Hidden Click</a>
</div>
<div>
<button type="button" onclick='callFetchGoogleDrive();' id="Fetch">Fetch Now!</button>
</div>
</body>
</html>