Nate Parsons
Nate Parsons

Reputation: 14901

Plot with d3.js in Google Apps Script?

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

Upvotes: 2

Views: 3764

Answers (3)

Tanya Gupta
Tanya Gupta

Reputation: 560

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

Upvotes: 0

Sujay Phadke
Sujay Phadke

Reputation: 2196

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

D3 within GAS

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

Upvotes: 2

DDD
DDD

Reputation: 1462

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.

Upvotes: 1

Related Questions