将一张工作表的Google电子表格制作成pdf文件,然后将其放入云端硬盘中 [英] Taking single sheet Google spreadsheet, making it into a pdf and placing it in Drive

查看:77
本文介绍了将一张工作表的Google电子表格制作成pdf文件,然后将其放入云端硬盘中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了几个小时尝试各种可能会导致某些结果的功能,但我却一无所获.代码(仅包含基本要点):

I've been hours at this trying every which way and any kind of function that might result in something and I'm getting nowhere and frustrated. The code (stripped to the bare essentials):

function alone() {
    try {
      spreadSheetFile = DocsList.getFileById("KEY FOR A GOOGLE SPREADSHEET").getAs('application/pdf');
    }
    catch (e) {
      Logger.log ("Catched something: "+e+"\n"+e.stack);
    }
      createFile('test file', content, 'application/pdf');
}

获取可怕的序列化连续性时发生意外异常",甚至没有抓住问题,因此未记录任何内容.我几乎在所有东西上都使用了标记在"getAs",getBlob()末尾的各种方法.我猜这只是Google代码的另一部分,它是nogga,nogga,noggonna可以在这里工作了.

Getting the dreaded "Unexpected exception upon serializing continuation" and not even going to the catch, so nothing logged. I've used various methods tagged onto the end of "getAs", getBlob(), just about everything. I'm guessing this is just another part of Google code that's nogga, nogga, noggonna work here anymore.

推荐答案

您的语法是完全错误的... 尝试这样,它将起作用:(此示例中的工作表具有一个值为空工作表"的单个单元格,并且已共享)

your syntax is simply wrong... try like this and it will work : (the sheet in this example has a single cell with value "empty sheet" and is shared)

function alone() {
try { 
 var spreadSheetFile = DocsList.getFileById("0AjUO-g3TOXkodHNtUUxwMEY5UHNCaTE3TDZLSmgweWc")
 var pdf = spreadSheetFile.getAs('application/pdf'); 
} catch (e) {
  Logger.log ("Catched something: "+e+"\n"+e.stack);
}
 DocsList.createFile(pdf)
}

这篇关于将一张工作表的Google电子表格制作成pdf文件,然后将其放入云端硬盘中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆