开发者

Problem in creating Excel Files with ruby

I am using Spreadsheet for ruby for creating excel files. Now I want that a excel must be created when it doesn开发者_如何学JAVAt exist. So I wrote this -:

require 'rubygems'
require 'spreadsheet'
include Spreadsheet

workbook = Spreadsheet.open "data__#{$KEYWORD}.xlsx" rescue Excel.new("data__#{$KEYWORD}.xlsx")

But Always keeps throwing this error -

undefined method `new' for Spreadsheet::Excel:Module (NoMethodError)


Looks like you want to use Spreadsheet::Excel::Workbook.new. As the error you get points out, Spreadsheet::Excel is a module, and not instantiable.

Check the documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜