Ruby Quick Reference

Quick reference for efficient coding

View the Project on GitHub YumaYX/RubyQuickReference

sheets_name.rb(roo)

This script essentially loads an Excel file named “book.xlsx”, retrieves the names of all the sheets present in the file, and does not perform any further actions beyond that. It could serve as a starting point for more advanced Excel file processing tasks in Ruby, such as reading data from specific sheets or manipulating Excel data programmatically.

Execution:

require 'roo'
#=> true

xlsx = Roo::Excelx.new('./book.xlsx')
#=> <#Roo::Excelx:3150 @tmpdir @shared @filename @sheet_files @sheet_names @...
xlsx.sheets
#=> ["mysheet", "mysheet2"]

Executed with Ruby 3.3.5