merge cells from Array of Arrays
See original GitHub issueHi, sorry if this question have been answered somewhere else but i have an array of arrays that is perfectly exported to xlsx file. What I need is to merge the first 2 cells. to make a sort of title for the table Here is my code so far :
exportFile() {
/* Format Raw Data reveived */
let formatedData = this.formatData();
/* convert state to workbook */
const ws = XLSX.utils.aoa_to_sheet(formatedData);
const wb = XLSX.utils.book_new();
wb = {
SheetNames:["sheet1"],
sheet1:{
"!merges":[
{ s:{r:0,c:0}, e:{r:0,c:1}}
]
}
}
XLSX.utils.book_append_sheet(wb, ws, this.state.sheetName);
/* generate XLSX file */
const wbout = XLSX.write(wb, { type: "binary", bookType: "xlsx" });
/* send to client */
saveAs(
new Blob([this.s2ab(wbout)], { type: "application/octet-stream" }),
this.state.fileName
);
}
Im using React btw
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to enter array formulas in merged cells - Get Digital Help
Select the merged cell. Go to tab "Home" on the ribbon. Press with left mouse button on the "Merge & Center" button to...
Read more >Combine ranges and arrays in Excel: VSTACK & HSTACK ...
The tutorial shows how to merge multiple arrays in Excel 365 vertically and horizontally using VSTACK and HSTACK functions.
Read more >Merge/flatten an array of arrays - javascript - Stack Overflow
For older browsers, you can use Array.prototype.concat to merge arrays: ... work on huge (e.g. 200 000 elements) arrays, and even if they...
Read more >5 ways to merge arrays in JavaScript and their differences
To merge elements from one array to another, we must first iterate(loop) through all the array elements. In the loop, we will retrieve...
Read more >Combine Cell Arrays - MATLAB & Simulink - MathWorks
To combine cell arrays of character vectors into one character vector, use the strjoin function.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to build up the worksheet first, then add the merges to the worksheet, then add the worksheet to the workbook: https://jsfiddle.net/1ny97xrb/
And if this project has been helpful for you, a star would show support 😃
Thank you