Open Source Ruby API for Excel Spreadsheet Processing
Free Ruby Library working with Excel XLSX file formats. It supports speedy parsing of XLSX file formats, generating a new workbook, reading existing XLSX files & so on.
What is rubyXL Library?
The rubyXL is a leading Ruby library for working with Excel XLSX file formats. The library has included a very useful function for a very speedy parsing of XLSX file formats inside Ruby applications. The library is capable of parsing the entire OOXML structure and can easily open, read and modify files created by MS Excel. The library is open source and is freely available under the MIT license for the general public.
The rubyXL library has included very useful functions related to Excel XLSX files creation and customization such as reading existing XLSX files, accessing a particular row or column of a spreadsheet, generating a new workbook, accessing and managing new cell properties, inserting and manage new rows and columns, adding new worksheets to a workbook, renaming worksheets, change formatting and styles of cell, rows or columns, enhanced borders, merging cells, delete worksheet rows or columns and many more
Getting Started with rubyXL
The recommend way to install rubyXL library is by using RubyGems. Please use the following command for smooth installation.
Install rubyX via RubyGems
gem install rubyXL
Generate New Excel Workbook via Ruby
Microsoft Excel is a powerful tool that gives users the ability to organize and store their data in a better way. It is the most used spreadsheet program and plays an important role in many business activities, education tasks as well as individual data organization. The rubyXL library gives software programmers the capability to generate a new Excel workbook with just a couple of lines of code. You can easily add a new worksheet, assign a name to the worksheet, delete the unwanted worksheet, and much more.
How to Create Excel Workbook via Ruby API?
require 'rubyXL'
wb = RubyXL::Workbook.new
wb.is_template = true
ws = wb[0]
ws.add_cell(0, 0, 'test')
wb.save('output.xltx')
Manage Columns and Rows via Ruby
The open source rubyXL library has included several important features related to managing rows and columns inside an Excel spreadsheet. The library has provided support for inserting new rows or columns, changing row height, modifying column width, changing fonts inside a row or column, changing alignment, deleting a set of rows or columns, modifying cells format, and so on
Access & Modify Existing Spreadsheets
The open source rubyXL gives software developers the capability to access and open already created spreadsheets using Ruby code. You can easily access a particular row and read its content and modify it according to your own needs. The library also provides support for adding new worksheets, images, and text with just a couple of lines of Ruby code. You can also select change cells, borders, fill, merge cells, and so on.
How to Access & Rename Worksheets via Ruby Library
workbook.worksheets[0] # Returns first worksheet
workbook[0] # Returns first worksheet
workbook['Sheet1']
//Renaming Worksheets
worksheet.sheet_name = 'Cool New Name' # Note that sheet name is limited to 31 characters by Excel.
Read Existing Excel File via Ruby
The free rubyXL library enables software developers to open and read existing Excel spreadsheet documents inside their own application using a couple of Ruby commands. The library has provided some useful functions to access and iterate through different rows and columns with ease.
How to Read Excel File via Ruby API?
//Replace 'ExcelFilePath' with the file path to read file
workbook = RubyXL::Parser.parse('ExcelFilePath')