react-excel-renderer
react-excel-renderer copied to clipboard
4th column name missing
I am trying to use this:
<OutTable data={rows ? rows : []} columns={cols ? cols : []} tableClassName="ExcelTable2007" tableHeaderRowClass="heading" />
to read a file that has 4 column. It shows me my col names/letters till D
including the index but for my last column, it doesn't show the column title or a letter at the top. Can this be fixed?
A workaround is to add an empty column:
renderFile = (fileObj) => {
//just pass the fileObj as parameter
ExcelRenderer(fileObj, (err, resp) => {
const columns = [{name: '', key: 0}];
resp.cols.map(item => {
columns.push({name: item.name, key: item.key + 1});
return null;
})
if (err) {
console.log(err);
} else {
this.setState({
dataLoaded: true,
cols: columns,
rows: resp.rows
});
}
});
}