How can I create new spreadsheet worksheets in Ruby using the Spreadsheet gem?

后端 未结 2 1690
北荒
北荒 2021-01-24 17:17

Specifically what I am trying to do is add new worksheets alongside ones already there. I\'ve tried to use book.create_worksheet :name => \'new_sheet\' but it ov

2条回答
  •  鱼传尺愫
    2021-01-24 17:49

    I found out that you can create many sheets with the same variable, you just have to change the name you put on it. For example:

    articles.each do |art| sheet1 = book.create_worksheet :name => art.code end

提交回复
热议问题