-
-
Save jennygreene88/3b24979d6234215f01b54e8e262a136a to your computer and use it in GitHub Desktop.
Trying to use the Sinatra-Spreadsheet library to deliver spreadsheets from Sinatra requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken directly from README example | |
get '/' do | |
response['Content-Disposition'] = "attachment; filename=yourtemplate.xls" | |
content_type 'application/excel' | |
spreadsheet :yourtemplate | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler/setup' | |
require 'sinatra/spreadsheet' | |
Bundler.require | |
require './app' | |
run Sinatra::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NameError at / | |
uninitialized constant Spreadsheet | |
file: spreadsheet.rb location: evaluate line: 33 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem 'sinatra-spreadsheet', | |
:require => 'sinatra/spreadsheet', | |
:git => 'git://github.com/sycobuny/sinatra-spreadsheet.git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken directly from README example | |
worksheet = workbook.create_worksheet(:name => 'My First Worksheet') | |
worksheet.row(0).concat(%w(Question Answer)) | |
worksheet.row(1).concat(["Isn't writing spreadsheets cool?", "Yes"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment