Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

216
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda