HTML Service - Form example doesn't work

前端 未结 3 1836
情歌与酒
情歌与酒 2021-01-22 05:41

I\'d really like to use a form in my app, and the official Google example doesn\'t work.

Passing a form as a parameter to a function, prevents the function from being ca

3条回答
  •  太阳男子
    2021-01-22 06:27

    Here is a workaround I have for file upload from a form in IFRAME mode. This supports multiple files:

    code.gs

    function doGet() {
      return HtmlService.createHtmlOutputFromFile('index').setSandboxMode(HtmlService.SandboxMode.IFRAME);
    
    }
    
    function saveFile(data,name) {
    
      var contentType = data.substring(5,data.indexOf(';'));
      var file = Utilities.newBlob(Utilities.base64Decode(data.substr(data.indexOf('base64,')+7)), contentType, name);
      DriveApp.getRootFolder().createFile(file);
    
    }
    

    index.html

提交回复
热议问题