Leveraging Google Charts API provides a great way to include dynamic charts in your S-Docs.
You can find more information on Google charts here:

Create A Remote Site Setting:

This functionality requires an entry in Salesforce's Remote Site Settings.

  1. Click Your Name > Setup > Security Controls > Remote Site Settings.
  2. Click New Remote Site button.
  3. Set the Remote Site Name field to SDOCS3.
  4. Set the Remote Site URL field to
  5. Make sure Active is checked and then click the Save button.

Google Chart Examples

Here are a few examples of Google charts:


The charts work by passing the Salesforce data to the Google API, which in turn dynamically builds and returns the chart as a PNG image.

Security Note: Unlike S-Docs, which works entirely within the platform, Google charts are hosted remotely. Depending on the chart, your data is passed from Salesforce to Google. Your security team would need to determine if this is an acceptable practice.

Images are rendered by using one URL request per chart. For example, you can manipulate the values in the following URL to render a different pie chart:,40&chs=250x100&chl=Jan|Feb

The link above will return the following image:


As you may begin to see, using Google Charts API is all about creating these URLs where you pass in the data points, legends and chart options. Depending on the chart, some of these URLs can be long and a bit complex.

Option 1: Use Formula Fields For Your Google Charts

Rather than building complex logic within S-Docs to create these URLs, we again leverage Salesforce formula fields to do the heavy lifting.

Here is a great tutorial from Salesforce on how to create Google Charts using a formula field:

The above tutorial will walk through how to build the following formula field to display a Won/Loss pie chart:

Then, we simply drop this formula field into our S-Doc template (be sure to check Contains Rich Text box).

Option 2: Use The Google Chart API URL In Your S-Docs Template

While more complex, another approach is to build the Google Chart API URL in your S-Doc Template and then mix in field values. This may offer you greater control. Using syntax similar to the following, you could add the image, where ChartLegend__c would just contain the value “Jan|Feb.”

Improving performance on pages with many Google charts:

The Google documentation offers a good performance tip if you plan to embed 5 or more charts. By appending a 1-9 before the “,” you can have the browser load the charts simultaneously. For example:

Note: S-Docs does not support the Google Visualization API.