murb / workbook Goto Github PK
View Code? Open in Web Editor NEWsimple framework for containing spreadsheet like data
License: MIT License
simple framework for containing spreadsheet like data
License: MIT License
Instead of workbook[0], I'd also would like to get a sheet by workbook[:sheet_1] if the sheet is called "Sheet 1".
For example, US and EU use different date notations, and not everything conforms to ISO standards...
Relates to #9
In the future I hope to return the cell value as inheriting from the original value's class, so you don't have to call #value as often.
See, this is undesirable: benefitter@7b9558d
One thing I was mulling over was how to subclass Workbook in order to add domain-specific functionality to the classes. I didn't want to monkey-patch your classes, as we may need more than one domain with different functionality, so subclassing seems the way to go.
The issue I was running into was that if I subclass Workbook::Book
and Workbook::Sheet
, for example, my Workbook::Book
subclass will still use the super-classes, such as creating a Workbook::Sheet
in #initialize
or #push
(instead of my new Sheet subclass). Short of overriding every method that references one of the other Workbook classes (ugh), there doesn't appear to be any way to easily do this right now (maybe I'm missing something obvious?).
Two solutions spring to mind: 1) create a new module for each domain, with classes that inherit from Workbook classes. And modify Workbook so that every reference to the Workbook constant is changed to something like self.class.const_get(self.class.name.split('::')[0..-2].join)
, which would get the module for self
. We'd probably put that code in a helper method.
Or 2) replace (in Workbook) every reference to a Workbook class constant (e.g., Workbook::Sheet) with a call to a helper method that returns the class constant. Then when you subclass a Workbook class, you just need to override those helper methods to point to your subclasses instead of the base Workbook classes.
These options are fairly similar; option 1 has the advantage of putting the subclasses into a new module (although you could do that with option 2 also), and it doesn't require you to override any methods. option 2 is probably a bit simpler.
Any ideas or feedback?
Hi,
I just update the gem in my rails project and now I get this error as I try to:
wb = Workbook::Book.open(workbook_path)
NoMethodError: undefined method `[]' for #<RubyXL::ColumnRange:0x00007fed3b078340>
from /mypath/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/workbook-0.4.3/lib/workbook/readers/xlsx_reader.rb:145:in `block (2 levels) in parse_xlsx'
Any help is appreciated
Worksheets are typically not only accessed via rows, but also collumns... add a class to support navigating via columns.
See for discussion:
As this gem has a dependency on "spreadsheets" which is GPLv3, it contaminates your code with the same license.
I suggest that you change your excel generator to : https://github.com/randym/axlsx which is MIT licensed.
While it can basically read and write XLSX files, markup is limited.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.