Share a Google Charts chart as a link
Google Charts draws a chart in the browser from a loader script and a data table, so the whole chart fits in one HTML file. Put the data in the page, upload the file, and send a link that opens the chart with its tooltips.
A Google Charts chart is JavaScript that needs a page to run in. A screenshot drops the tooltips, and an HTML file sent as an attachment opens as code or gets blocked by the mail client.
One HTML file that loads the Google Charts loader, holds the data and draws the chart, hosted at a link, opens on any device.
Put the chart in one file
Create chart.html with this structure:
- ✓<!doctype html>, <meta charset="utf-8"> and <meta name="viewport" content="width=device-width, initial-scale=1"> in the head.
- ✓The loader: <script src="https://www.gstatic.com/charts/loader.js"></script>. Google requires the loader to come from gstatic.com, so keep this URL rather than saving a copy next to your file.
- ✓A container with a height: <div id="chart" style="width:100%;height:400px"></div>. A container with no height draws an empty chart.
- ✓A <script> block after the container: google.charts.load("current", { packages: ["corechart"] }); google.charts.setOnLoadCallback(drawChart); then a drawChart function that builds the data table and calls chart.draw(data, options).
- ✓Draw only inside the callback. Calling google.visualization before the loader finishes fails with "google.visualization is undefined".
Keep the data inside the page
Write the rows into the script with arrayToDataTable: const data = google.visualization.arrayToDataTable([["Month", "Signups"], ["Jan", 12], ["Feb", 19], ["Mar", 7]]); new google.visualization.ColumnChart(document.getElementById("chart")).draw(data, { legend: "none" }); Tested in Chrome: that code drew three columns.
Charts copied from a project often read a local file or a private Google Sheet. An uploaded page is hosted on its own and its viewers are not signed in to your Google account, so a private Sheet query or a request for a second file fails and the chart never draws. Paste the rows in instead.
Charts other than the core set, such as Geo charts, Timelines or Gantt, need their package in the load call: packages: ["corechart", "geochart"]. A Geo chart that places markers by address or city name also needs a mapsApiKey from Google in the same options object.
Upload it and send the link
Drag the .html file onto the FileShare Pro dashboard and copy the link. The chart draws when the page opens, tooltips show on hover as they did locally, and viewers need no account.
If the page is blank once hosted, open the browser console. "google is not defined" means the loader script tag is missing or comes after your chart code. Why an AI page works in chat but breaks when hosted covers charts an assistant wrote.
Turn on comments and viewers can leave a note on the page after typing a name. When the numbers change, upload the new file over the old one and the link stays the same: updating a shared link without changing it.
Other chart libraries: Chart.js, Highcharts, ECharts, Plotly, Vega-Lite, Observable Plot, D3.
Frequently asked
Put the gstatic.com loader script, a container with a height, your data as an arrayToDataTable call, and the draw code inside google.charts.setOnLoadCallback into one HTML file. Upload it to a host that serves HTML as a web page and send the link.
No. Google requires the loader to be loaded from https://www.gstatic.com/charts/loader.js. The hosted page loads it from there when a viewer opens the link.
No, as long as the data is written into the page. A chart that queries a private Google Sheet only works for people signed in with access to that Sheet.
Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.
Drop the file, copy the link — live in seconds, free plan included.
Start sharing free