ruby on rails - How can I allow the user to download spreadsheets created using axlsx gem -


in controller have code create add content workbook

def report     p = axlsx::package.new    wb = p.workbook    wb.add_wordsheet(:name => "viewer summary") |sheet|        sheed.add_row["lol"]    end   end 

my sheet has lot more stuff added sheet not think necessary type out.

in view have button calls above report method in controller. when user clicks button want users browser download spreadsheet. possible axlsx gem?

i think method looking send_data http://apidock.com/rails/actioncontroller/streaming/send_data

basically this, although i'd consider removing creation , adding data wb own class.

def report    p = axlsx::package.new   wb = p.workbook   wb.add_wordsheet(:name => "viewer summary") |sheet|     sheet.add_row["lol"]   format.xlsx { send_data(wb) } #something similar that.   end  end 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -