Complete Coders
Posts: 4
Joined: Sun Oct 28, 2018 11:20 pm

Issue using Google Sheets as data source

I am working off the samples from this github: https://github.com/JackDougherty/highch ... gle-sheets

Using the line.html file I did the following:

1. Ran HTML file to verify it works in current state
2. I opened the spreadsheet referenced in the file and copied it to my google drive.
3. Turned on "view for anyone with the link" in new spreadsheet
4. replaced the googleSpreadsheetKey in the html file
5. Ran html file again

I get this error 405 on the address below. It seems like it is trying to log into google. Any ideas?

https://accounts.google.com/ServiceLogi ... mpl=sheets
bastss
Site Admin
Posts: 1192
Joined: Wed Oct 17, 2018 10:59 am

Re: Issue using Google Sheets as data source

Hi Complete Coders,

I have prepared a simplified demo: http://jsfiddle.net/Bastss/5z26qjfw/ with the data source from this Google Sheets: https://docs.google.com/spreadsheets/d/ ... edit#gid=0.

Notice how we can set a key value:

Code: Select all

data: {
    googleSpreadsheetKey: '1eK264_It9ezV8g1Ah_PROiOiOMkKg3KYszvcNHbjso0'
  }
And don't forget to import the data module:

Code: Select all

<script src="https://code.highcharts.com/modules/data.js"></script>
Probably, the link to your sheet is not working because it is not public. I suppose that your issue is more related to your settings in google sheets.

Here you can find some information about getting data from Google Sheets:
https://api.highcharts.com/highcharts/d ... adsheetKey
https://developers.google.com/gdata/sam ... eet_sample

Best regards!
Sebastian Wędzel,
Highcharts Developer
Complete Coders
Posts: 4
Joined: Sun Oct 28, 2018 11:20 pm

Re: Issue using Google Sheets as data source

I have the sheet set to public access. See the sheet below.

https://docs.google.com/spreadsheets/d/ ... edit#gid=0

The HTML I am using works with a different sheet: 1eGnc81p7-Rn7O2LMcOfSIht-Z9NYU-KAi9vJPjf6SWA so I know it is not the HTML that is the problem.

Any ideas?
Complete Coders
Posts: 4
Joined: Sun Oct 28, 2018 11:20 pm

Re: Issue using Google Sheets as data source

Ok, I finally figured it out. It appears I have to File -> Publish to the web for it to work.
wittrup
Posts: 1
Joined: Tue Apr 14, 2020 10:53 am

Re: Issue using Google Sheets as data source

Forgive the bump.
I spent too much time figuring out exactly what settings are necessary.
Complete Coders wrote: Mon Oct 29, 2018 9:21 pm Ok, I finally figured it out. It appears I have to File -> Publish to the web for it to work.
Short: Google Sheet needs to be published (File -> Publish) and Shared Public on the web - Anyone on the Internet can find and view.
Attached is a screenshot.
Highcharts-googleSpreadsheetKey.png
Highcharts-googleSpreadsheetKey.png (79.29 KiB) Viewed 1408 times
mateuszkornecki
Posts: 1222
Joined: Mon Oct 28, 2019 10:29 am

Re: Issue using Google Sheets as data source

Thanks for sharing your solution with us!

Best regards.
Mateusz Kornecki
Highcharts Developer

Return to “Highcharts Usage”