Plot with d3.js in Google Apps Script?

2019-07-18 20:42发布

Since Google Apps Script is in javascript, I was wondering if I could somehow import it and use it instead of the charting library.

3条回答
劫难
2楼-- · 2019-07-18 20:59

Yes you can import d3 and use it in Google Apps Script. To do so, you need to include it in your script as described here: https://github.com/d3/d3

Here is a hello world GAS script in Gist

查看更多
相关推荐>>
3楼-- · 2019-07-18 21:01

As of 2016, it works perfectly. Here is a simple example.

D3 within GAS

You can find the code here: github-D3-GAS

查看更多
干净又极端
4楼-- · 2019-07-18 21:19

Yes, in principle you can include any Javascript library you like. However, it must comply with Google's Caja sanitization - see the "JavaScript Libraries" subheading here. You will need to build your app using the Html Service and not Ui Service.


[Update 02/09/2015] The HtmlService has moved on a little since this was originally written. This page on restrictions details more about the 3 different sandbox modes. The IFRAME mode does not use the Caja sanitization.

查看更多
登录 后发表回答