I am struggling with creating a table from a variable that contains an array of arrays, which is parsed code from an excel file.
I attempted to upload the file and build the table using the following approaches:
tabela.forEach((elem, index) => {
console.log(elem[0], index[1])
const row = tableBody.insertRow(index)
const employeeCell = row.insertCell(0)
let content = document.createTextNode(elem[0])
employeeCell.appendChild(content)
})
and also tried this method:
for (let i = 1; i < tabela.length; i++) {
const row = tableBody.insertRow(tabela[1])
const employeeCell = row.insertCell(0)
let content = document.createTextNode(tabela[0])
employeeCell.appendChild(content)
}
Unfortunately, both approaches have yielded unexpected results.
I really want to comprehend what I am doing wrong but seem to be facing difficulties.
The variable tabela
consists of 13 elements, each being an array with 7 elements.
Can anyone offer guidance on how to correctly build a table using the parsed code stored in the "tabela" variable?