0

I have 3 files (name1.csv name2.csv name3.csv) Is it possible to merge them in one template.xls file which consists of 3 sheets (name1 name2 name 3) using bash script

Before I used for single convert:

for f in name1.csv; do ssconvert $f ${f%.csv}.xls; done

But now I need to keep it all in one file. And would be nice to configure the storage directory

Thanks in advance

  • I read up on the ssconvert man page, and it seems like it's not possible. But if you read [this page](https://stackoverflow.com/questions/1895755/convert-xml-to-excel-with-multiple-worksheet) you can see that multi-page Excel files can be created using XML, then later saved as XLSX or XLS. The XML creation can be scripted in different ways, depending on your mileage. – MyICQ Apr 07 '21 at 20:53
  • I do not expect a solution only via ssconvert. There is the [solution](https://stackoverflow.com/questions/49324636/multiple-csv-files-into-a-xlsx-file-but-different-sheets-using-powershell) for PowerShell and I am looking for a solution for Bash – Yevhenii Tabakar Apr 08 '21 at 04:39

1 Answers1

0

There is one way, to use the csv2xlsx application source

./csv2xlsx -o /Path/All.xlsx -s name1 -s name2 -s name3 name1.csv name2.csv name3.csv

Where

  • name1.csv your csv file
  • - s name1 Its how you want to name sheet in your xlsx
  • -o /Path/All.xlsx path and name the final xlsx file