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

202
Views
How can i display names and data of csv files using javascript on a webpage which are present in my project folder(files to be fetched from server)

I have multiple files in a project folder which are csv files. I want to fetch all the files names from the folder and trying to display on webpage each csv file under its name. This is the code I am trying to use but its displaying the only file which I am giving the full path. Please help me to get all the files and display their data in webpage.

<h1>Choose file and display its Name</h1>
<style>
     td {
        border: 2px solid blue;
    }
</style>
<button onclick="showNames()">
    Click Me To Get Student Details
</button>
<table></table>
<script>

 newfiles=[]
 newfiles=fetch("../static/csvfiles/")
 console.log(newfiles)
   // for file in fetch(
    onload = fetch("../static/sysRestartTestData.csv").then(res => {
        return res.text()
    }).then(data => {
        let result = data.split(/\r?\n|\r/).map(e => {
            return e.split(",")
        })
        result.forEach(e => {
            let m = e.map(e => {
                return `<td>${e}</td>`;
            }).join("")
            let ce = document.createElement("tr");
            ce.innerHTML = m;
            if (ce.innerText != "") {
                document.querySelector("table").appendChild(ce);
            }
            // console.log(m);

        })
    })
  </script>
about 4 years ago · Juan Pablo Isaza
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!