I was wondering i am using the Axlsx gem to generate excel documents from data in our system. I have several worksheets that use data validation and all the formulas are on a worksheet called lists. Is it possible to hide that worksheet so that people dont mess up the data validations?
I have looked through the lib and saw that you can hide rows or columns but nowhere about worksheets?
It is possible to hide a worksheet. You simply have to define its :state property:
p = Axlsx::Package.new
wb = p.workbook
# Worksheets in the :hidden state can be shown using the sheet formatting
# properties in excel.
wb.add_worksheet name: 'hidden', state: :hidden do |sheet|
sheet.add_row ['you cant see me!']
end
# :very_hidden sheets should be inaccessible to end users.
wb.add_worksheet name: 'very hidden', state: :very_hidden do |sheet|
sheet.add_row ['you really cant see me!']
end
Sources:
https://github.com/randym/axlsx/blob/master/examples/example.rb
https://github.com/randym/axlsx/blob/master/lib/axlsx/workbook/worksheet/worksheet.rb