带有Chrome扩展程序的Google Sheets API,如何使用? [英] Google sheets API with chrome extension, how to use?

查看:140
本文介绍了带有Chrome扩展程序的Google Sheets API,如何使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做我的第一个Chrome扩展程序.我的想法是调用Google Sheets API在扩展程序的Google电子表格中添加一行.我指的是链接,成功地尝试了API在我想要的工作表中追加行.

I am making my first chrome extension. My idea is to call Google Sheets API to append a row in a google spreadsheet from my extension. I am referring this link for the same and successfully tried the API to append row in my desired sheet.

现在,我正在尝试从chrome扩展代码文件中执行相同的操作.您如何为扩展程序使用相同的示例代码,因为我们的扩展程序不允许内联js.任何样品或基本样板都会有所帮助.

Now I am trying to do the same from my chrome extension code files. How do you use the same sample code for your extension as our extension will not allow inline js. Any sample or basic boilerplate would help.

非常感谢.

推荐答案

由于内联JavaScript,您将收到该错误.
Chrome扩展程序不允许任何内联脚本. 在此处阅读.

You are receiving that error because of the inline JavaScript.
Chrome Extensions do not allow any inline scripting. Read Here.

嵌入式JavaScript将不会执行
内联JavaScript将不会执行.此限制禁止内联块和内联事件处理程序(例如).

Inline JavaScript will not be executed
Inline JavaScript will not be executed. This restriction bans both inline blocks and inline event handlers (e.g. ).

因此,任何JavaScript都必须来自其自己的.js文件.
通常在popup.js中对该页面使用popup.html和所有JavaScript.
options.html和options.js也是如此.

So any JavaScript must come from its own .js file.
It is common to use popup.html and all JavaScript for that page in popup.js.
Same goes for options.html and options.js.

有用的链接:
Chrome扩展程序和Google表格
使用OAuth的教程

Helpful Links:
Chrome Extension and Google Sheets
Tutorial for using OAuth

这篇关于带有Chrome扩展程序的Google Sheets API,如何使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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