exceljs icon indicating copy to clipboard operation
exceljs copied to clipboard

Cloning/Duplicating a "TEMPLATE" worksheet

Open msedek opened this issue 8 years ago • 2 comments

request for the author to add to the guide the method to clone a worksheet as the feature is present but not documented and it is such a useful feature... often times we have a template we need to duplicate over and over in a workbook and the process to do that is not described in the documentation resulting in hours and hours lost searching and finding undocumented and bad implemented stuff in the issues and there is no other source of information about but here, so I want to contribute with the correct way (or AT LEAST what I have found) is working perfectly and for massive worksheet clonation with 0 issue at the moment

let sheetToClone = workbook.getWorkSheet("ID TO CLONE")
let cloneSheet = workbook.addWorkSheet("Sheet")

cloneSheet.model = sheetToClone.model
cloneSheet.name = "THE REAL ID/NAME YOU WANT FOR THIS SHEET"

//DO STUFF HERE



return workbook.xlsx.writeFile("your_file")

P.S sorry if this is not the write place to put this.. feel free to delete it but i think many devs out there would benefit from this as I do and I couldn't before

msedek avatar Oct 19 '18 13:10 msedek

See also #91 #337.

zypA13510 avatar Jan 29 '19 02:01 zypA13510

when done in react the file comes out corrupted

LoganBram avatar Jul 05 '23 17:07 LoganBram