Skip to content

Commit 2440cfc

Browse files
committed
Fixed the generator using papa parse
1 parent fb07b0e commit 2440cfc

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

039_madlibs/P5/sketch.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,28 @@ var txt =
1010

1111
function setup() {
1212
noCanvas();
13-
Tabletop.init({
14-
key: '15WyEmfu6B1UCzzqeacYnzI8lutrxF6uWvFDiSteBqTs',
15-
callback: gotData,
16-
simpleSheet: true
17-
});
13+
// Tabletop.init({
14+
// key: '15WyEmfu6B1UCzzqeacYnzI8lutrxF6uWvFDiSteBqTs',
15+
// callback: gotData,
16+
// simpleSheet: true
17+
// });
18+
19+
// Unfortunately since 2020 tabletop.js has been deprecated
20+
// because of some changes that Google had made. To learn
21+
// more about it, visit https://github.com/jsoma/tabletop
22+
23+
// In this example, the library Papa Parse has been used
24+
// in a very similar fashion, so do something like this
25+
// instead. Keep in mind that the Google Sheet link has
26+
// to a CSV link, rather than a web page!
27+
Papa.parse('https://docs.google.com/spreadsheets/d/e/2PACX-1vSiJDczupcvlAJxd70RJ9hZina9cqweCiTj1EkYrH_17FhFBjdMFTEY2TOMmhwGBHGR05y7QRXLNbo6/pub?output=csv', {
28+
download: true,
29+
header: true,
30+
complete: function(results) {
31+
var stuff = results.data
32+
data = stuff
33+
}
34+
})
1835

1936
var button = createButton('generate madlib');
2037
button.mousePressed(generate);
@@ -31,6 +48,6 @@ function generate() {
3148
createP(madlib);
3249
}
3350

34-
function gotData(stuff, tabletop) {
35-
data = stuff;
36-
}
51+
// function gotData(stuff, tabletop) {
52+
// data = stuff;
53+
// }

0 commit comments

Comments
 (0)