4

I try to tech data from a Google spreadsheet using this code

function init() {
    Papa.parse(public_spreadsheet_url, {
      download: true,
      header: true,
      complete: showInfo
    })
  }

This yields the following CORS error:

Access to XMLHttpRequest at 'link to shared Google Sheet CSV' from origin 'my domain' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

jak
  • 184
  • 7

2 Answers2

9

It looks like Google has changed something in the last few days. This is preventing sites from linking direct to a Google Sheet. You will need to cache the file using a remote service to get around the CORS issue.

A service like https://cors-anywhere.herokuapp.com will do the job but there are request limits.

John Croucher
  • 169
  • 2
  • 9
2

I had the same problem, I decided to download the tsv from google sheets and put it in my project folder, but I continued getting the CORS error when I use papa parse to parse a tsv file in my project, so I think it's a papa parse issue, not google sheets. I think it might be this commit: https://github.com/mholt/PapaParse/commit/018f5dfe419c68f4f084df3d4452190cd501a74a

leucotic
  • 61
  • 6