I have an excel template which has only one sheet(Sheet1).Is it possible using rubyxl to generate multiple sheets that uses Sheet1 as template in my output file?
Create multiple sheets that uses same template using rubyxl
2.1k Views Asked by zoro At
2
I was able to achieve this by following these steps:
1. parse xlsx/xlsm file
2. take worksheet template
3. add a new worksheet to the workbook
4. duplicate sheet_data
Unfortunately
Marshal.dump
return errorno _dump_data is defined for class Nokogiri::XML::Namespace
for sheet_data's cells, so I had to write this dirty workaround.5. copy everything else you need
for more attributes inspect
template.instance_variables
You can also remove the template
And return workbook with a new worksheet(s) by
...in Your Rails controller
or just save it to file