I am using this Spreadsheet gem to export xls file.
I have the following codes in my controller:
def export @data = Data.all book = Spreadsheet:
I understand this is insanely old, but I was looking for it so someone else might be.
This is the answer. (I'm using Sinatra.)
https://github.com/zdavatz/spreadsheet/issues/125#issuecomment-370157753