Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
How can I open and parse a local csv file into an array?

I'm trying to run a D3 visualization that reads data from a local .csv file (same directory as the javascript and HTML files), and I am looking for a way to parse this .csv file into an array of dictionaries than can then be fed to D3. However, all the solutions that I'm seeing in the Internet require either an or downloading the csv online/creating some kind of webserver or request, but I would like to avoid those. Is there any way to just open the file and parse it, sort of like in Python that you can just open('myfile.csv').

I would like to end up with a File object that can be passed to Papaparse. Thank you in advance, and sorry is this duplicated, I've been looking for this for a while so I thought I should try to ask it.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When you are in the browser you run JS in a sandbox that has no access to the local filesystem. This is for security reasons. However, you can popup a file open dialog on the browser and import it in memory. Please check this SO thread and links:

Is it possible to upload a file in memory using javascript for processing before sending it to server?

For reference if thread is deleted:

https://developer.mozilla.org/en-US/docs/web/api/file

https://developer.mozilla.org/en-US/docs/web/api/file/using_files_from_web_applications

Also, https://techoverflow.net/2018/03/30/reading-an-uploaded-file-into-memory-using-pure-javascript/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!