You're re-creating and saving the Workbook
every time you call csvToXLS
, so only the last call survives, overwriting all others.
Create the Workbook
only once, before you start your for
loop, passing it into csvToXLS
. then that method will create a new Sheet
on an existing Workbook
. Then after the for
loop ends, you can write out and save the Workbook
.