ReferenceError:“驱动器"没有定义 [英] ReferenceError: "Drive" is not defined

查看:55
本文介绍了ReferenceError:“驱动器"没有定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google App Maker中,我正在ServerScript中编写一个函数,该函数会将用户上传的Excel电子表格转换为Google电子表格.我正在使用这段代码( https://stackoverflow.com/a/35597644/9878092 ),但是我在得到

In Google App Maker, I am writing a function in ServerScript that will convert a user-uploaded Excel spreadsheet to Google spreadsheet. I am using this piece of code (https://stackoverflow.com/a/35597644/9878092), but I am getting

ReferenceError:未定义驱动器".

ReferenceError: "Drive" is not defined.

我尝试使用直接从链接获得的代码行:

I tried using the line of code that I got directly from the link:

file = Drive.Files.insert(file, xlsxBlob, {

和我自己的编辑版本:

file = Drive.Files.update(file, ssFileID, xlsxBlob, {

其中 ssFileID 是预制的Google表格的文件ID,我要将用户上传的Excel电子表格中的数据插入其中.如何解决此错误?

Where ssFileID is the file id of the pre-made Google Sheet I want to insert the data from a user-uploaded Excel spreadsheet into. How do I fix this error?

推荐答案

您遇到了多个问题:

  1. 未定义驱动器"错误,请参阅此

从脚本(以Code.gs开头的位置)中打开菜单并使用:资源-高级Google服务,然后检查 Drive API v2

Open menu from your script ( the place you start with Code.gs) and use : Resources - Advanced Google services and check on the Drive API v2

  1. 使用驱动器中的文件进行更改和上传

  1. Use files from drive to change and upload

  • 您的源代码可以识别文件和使用过的文件;
  • 定义资源和blob;
  • 启用高级驱动器API服务:var file = Drive.Files.insert(resource,blob,...);

这篇关于ReferenceError:“驱动器"没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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