exporting spreadsheet to pdf then saving the file in google drive

前端 未结 2 994
北荒
北荒 2021-01-06 19:28

I\'m having problems saving to google drive after printing a google spreadsheet to pdf. If i just put the \"printurl\" string into a browser, it will automatically give me t

2条回答
  •  长发绾君心
    2021-01-06 19:43

    You can do it in a much simpler fashion

    function printpdf(){
    
      var spreadsheet_id="0Aiy1DTQRndx6dDRidXoxNzlXZFhxd2FITTlBbnUybnc";
      var spreadsheetFile = DocsList.getFileById(spreadsheet_id); 
      var blob = spreadsheetFile.getAs('application/pdf'); 
      DocsList.createFile(blob);
    }
    

    Note that the DocsList.createFile(blob) works only with Google Apps accounts.

提交回复
热议问题