Skip to content
πŸ“Š React component that renders Google Sheets as attractive charts with minimum effort
Branch: master
Clone or download
aortbals Merge pull request #2 from postlight/dependabot/npm_and_yarn/axios-0.…

chore(deps): bump axios from 0.18.0 to 0.18.1
Latest commit 07a4ee1 Jun 5, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fix: wrong attribute used Mar 18, 2019
static/images docs: add gif to readme Mar 14, 2019
.babelrc chore: fix identation Mar 14, 2019
.eslintrc feat: add suffix Mar 18, 2019
.gitignore initial commit Mar 13, 2019
.prettierrc feat: add suffix Mar 18, 2019 docs: Add links to README May 19, 2019
package-lock.json chore(deps): bump axios from 0.18.0 to 0.18.1 Jun 5, 2019
package.json docs: improve docs Mar 18, 2019
webpack.config.js chore: fix identation Mar 14, 2019

React Google Sheet to Chart

Postlight's React Google Sheet to Chart React component transforms Google Sheets to attractive charts in your webapp with minimal effort. Read all about it in this handy introduction.

Try it now at the demo site and check out the demo site GitHub repository.

Robo Chart preview


The package can be installed via NPM:

npm install @postlight/react-google-sheet-to-chart --save

# or 

yarn add @postlight/react-google-sheet-to-chart


To use this component, you'll need a Google API key. You can generate one here.

Second, you'll need a Google Sheet containing the data you wish to plot. (Be sure to check out the spreadsheet format guidelines.)

Finally, import the React component and initialize it with at least three required props:

  • id: Spreadsheet ID, e.g. 1RE_JYUCXBXY2LNV5Tp5GegLnMue-CpfTVMxjdudZ8Js (extractable from a Google sheet URL)
  • sheet: Sheet name to parse data from, e.g. Sheet1
  • token: The Google API key you created above
import RoboChart from '@postlight/react-google-sheet-to-chart';

// ...your component code and then...


Quick setup in an app

npx create-react-app my-app
cd my-app
npm install
  • Install the package
npm install @postlight/react-google-sheet-to-chart --save
  • Paste the following in App.js and replace GOOGLE_SPREADSHEET_ID and GENERATED_GOOGLE_API_KEY with appropriate values:
import React, { Component } from 'react';
import RoboChart from '@postlight/react-google-sheet-to-chart';
import './App.css';

const style = { width: '1200px', margin: '0 auto' };
class App extends Component {
  render() {
    return (
      <div style={style}>
export default App;
  • Start the project
npm start

Optional props

  • start e.g. "A5" (start and end create a custom range for your data)
  • end e.g. "E15"
  • title This is the chart title, e.g. "My Accounts"
  • flipAxis default: {false}
  • startFrom default: {0}
  • stacked Use only with type bar, default: {false}
  • type default: "line", should be one of: "line", "bar", "horizontalBar", "pie", "semi-pie", "doughnut", "semi-doughnut"
  • colors e.g. {['#a1a1a1', '#434343', '#ff0055']}
  • xsuffix Add a suffix to x-Axis labels, e.g. " USD"
  • ysuffix Add a suffix to y-Axis labels


  sheet="Companies Values"
  title="Companies values in Billion $"
  colors={['#a1a1a1', '#995500', '#990055', '#009955']}

Robo Chart preview

Spreadsheet format

In order to successfuly generate a chart, the Spreadsheet should have Row titles, Column titles and Values, example:

Spreadsheet example


Licensed under either of the below, at your preference:


Unless it is explicitly stated otherwise, any contribution intentionally submitted for inclusion in the work, as defined in the Apache-2.0 license, shall be dual licensed as above without any additional terms or conditions.

πŸ”¬ A Labs project from your friends at Postlight. Happy coding!

You can’t perform that action at this time.