CodingTrain / CodingTrain/Suggestion-Box

8.15 drag and drop csv to extract table

Open
#736 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
570
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Hi Daniel,

I've been watching your p5.js tutorial series. It's excellent. Thank you!

I'm trying to combine the dropzone you demonstrate in 8.15 with the tabular data functionality shown in 13.5. I'm stuck so I came here to see if anyone else is having the same issue. I can't find any threads with the same question though.

I am having a problem as the table I get from the file is showing an empty array in the console:
_p5.Table {columns: Array(0), rows: Array(0)}
columns
:
(2) ["Destination", "Price"]
rows
:
(2421) [p5.TableRow, p5.TableRow …]
__proto__
:
Object_

_undefined_

This means I cannot access the data. Everything just returns undefined. How can I fix this so that the array shows {columns: Array(2), rows: Array(2421)} as expected?

My code:
function gotFile(myfile){
vox2 = loadTable(myfile.data,"csv", "header");
console.log(vox2);
console.log(vox2[0]);
}

Any help you can offer would be very much appreciated.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported loadTable behavior using the dropzone example from tutorial 8.15, the table example from 13.5, and the supplied gotFile code. Compare the p5.Table object and CSV-loading path; done means the issue has a confirmed cause and a documented fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.