Project

xlsx-DSL

0.0
No release in over a year
A gem using DSL for reading&writing Excel (.xlsx).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.12.0

Runtime

~> 1.13.10
~> 2.3.2
 Project Readme

xlsx-DSL

A gem using DSL for reading&writing Excel (.xlsx).

Usage

Require gem
require 'xlsx/DSL' 

DSL

Select one worksheet
OpenXML::SpreadsheetML::open 'new.xlsx' do |wb|
  wb['Sheet']
  wb.sheets.first
end
Acquire cells' value
OpenXML::SpreadsheetML::open 'new.xlsx' do |wb|
  wb['Sheet']['A1']                          # a value of one cell
  wb['Sheet']['A']                           # values of one column
  wb['Sheet']['1']                           # values of one row
  wb['Sheet']['1:2']; wb['Sheet']['1-2']     # values of rows
  wb['Sheet']['A:C']; wb['Sheet']['A-C']     # values of columns
  wb['Sheet']['B2:C4']; wb['Sheet']['B2-C4'] # values of a matrix
end

OOP

Select one worksheet
wb = OpenXML::SpreadsheetML::open 'new.xlsx'          # Initialize one Excel using open_helper
wb = OpenXML::SpreadsheetML::Workbook.new 'new.xlsx'  # Initialize one Excel using Workbook.new
wb = OpenXML::SpreadsheetML::Workbook.open 'new.xlsx' # Workbook.open is alias Workbook.new
ws = wb['Sheet']
ws = wb.sheets.first
Acquire cells' value
ws['A1']                 # a value of one cell
ws['A']                  # values of one column
ws['1']                  # values of one row
ws['1:2']; ws['1-2']     # values of rows
ws['A:C']; ws['A-C']     # values of columns
ws['B2:C4']; ws['B2-C4'] # values of a matrix