Javascript 如何删除空单元格并将所有值放在顶部?
我在react上使用xlsx导出excel文件,但是我的excel是这样的。我想删除空列,并将内容上移到顶部。可能吗?我的建议如下Javascript 如何删除空单元格并将所有值放在顶部?,javascript,reactjs,xlsx,Javascript,Reactjs,Xlsx,我在react上使用xlsx导出excel文件,但是我的excel是这样的。我想删除空列,并将内容上移到顶部。可能吗?我的建议如下 API.getProposedAttributes(this.state.setDepartment).then(response => response.json().then(d =>{ this.setState({proposedData: d},() =>{ const fileType = 'application/vnd.
API.getProposedAttributes(this.state.setDepartment).then(response => response.json().then(d =>{
this.setState({proposedData: d},() =>{
const fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
const fileExtension = '.xlsx';
const ws = XLSX.utils.json_to_sheet(csvData);
const ws2 =XLSX.utils.json_to_sheet(this.state.proposedData)
const wb = { Sheets: {'data':ws,'data2':ws2 }, SheetNames: ['data','data2'] };
const excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
const data = new Blob([excelBuffer], {type: fileType});
FileSaver.saveAs(data, `Catalogue_${this.state.setSeason}_${this.state.setEventCode}_${this.state.setDepartment}` + fileExtension);