P5.js: loadTable() not loading data from published Google Sheets

Created on 15 Aug 2020  路  3Comments  路  Source: processing/p5.js

I can get data to load when using the share link, but that returns a lot of garbage.
This has worked previously (Mid April) but now those sketches don't work either.

Issues in ...
Local server and the web editor.
Firefox and Safari.
Macbook Mid-2015 - Catalina v10.15.6

// let url = 'https://docs.google.com/spreadsheets/d/1IDfirbq3lmalAeghfuCv9xwnIPgwtQgb-chI7EWwueM/edit?usp=sharing';

let url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vRPLBoFDY3y1qJkyxpQ2gcrrmBL2RfnUh7RkvHobN_BfbnY4T5WVGsC6hK7qJEisijKi7SLtTZ7aYyn/pub?gid=0&single=true&output=csv',
  data;

function preload() {
  //remote file
  data = loadTable(url, 'csv', 'header');
}

function setup() {
  createCanvas(400, 400);
  if (data) {
    console.log('data loaded ... ');
  } else {

    console.log('no data loaded ... ');
  }
}

console log

p5.js says: It looks like there was a problem loading your table file. Try checking if the file path (https://docs.google.com/spreadsheets/d/e/2PACX-1vRPLBoFDY3y1鈥sC6hK7qJEisijKi7SLtTZ7aYyn/pub?gid=0&single=true&output=csv) is correct, hosting the file online, or running a local server. (More info at https://github.com/processing/p5.js/wiki/Local-server)
bug

All 3 comments

It seems Google Sheets does not allow the loading of data cross origin, you can read about it here.

@slowizzm Just to add on to the previous comment, for many sites that don't support cross-origin data requests you might find it useful to use a third-party "CORS Proxy" as seen here: https://editor.p5js.org/akshay.padte/sketches/2xn-zfhWN
It may not be completely reliable though

@akshay-99 Thank you, your suggestions seems to be working so far for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sps014 picture sps014  路  3Comments

b0nb0n picture b0nb0n  路  3Comments

Vbbab picture Vbbab  路  3Comments

stalgiag picture stalgiag  路  3Comments

oranyelik picture oranyelik  路  3Comments