Sha256: f8f153a3a4e7a17dad410621e2d6af8fbb7cb9163f3602b644e4e97ed172cfc8
Contents?: true
Size: 945 Bytes
Versions: 3
Compression:
Stored size: 945 Bytes
Contents
require 'nokogiri' require 'tmpdir' require 'zip' module RubyXL class Parser def self.parse(file_path, opts = {}) self.new(opts).parse(file_path) end # +:data_only+ allows only the sheet data to be parsed, so as to speed up parsing. # However, using this option will result in date-formatted cells being interpreted as numbers. def initialize(opts = {}) @opts = opts end def parse(xl_file_path) root = RubyXL::WorkbookRoot.parse_file(xl_file_path, @opts) wb = root.workbook wb.sheets.each_with_index { |sheet, i| sheet_obj = wb.relationship_container.related_files[sheet.r_id] wb.worksheets[i] = sheet_obj # Must be done first so the sheet becomes aware of its number sheet_obj.workbook = wb sheet_obj.sheet_name = sheet.name sheet_obj.sheet_id = sheet.sheet_id sheet_obj.state = sheet.state } wb end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubyXL-3.2.0 | lib/rubyXL/parser.rb |
rubyXL-3.1.2 | lib/rubyXL/parser.rb |
rubyXL-3.1.0 | lib/rubyXL/parser.rb |