How to read data from an excel file using ruby

Publicado el: 29 agosto 2022
en el canal de: Shashikant Rai
1,223
13

How to read data from an excel file using ruby Spreadsheet gem file

Pre Requisite : make sure spreadsheet gem file is installed at your machine. if not then installed it using below command

gem install spreadsheet

Code to read an excel file :-

require 'rubygems'
require 'spreadsheet'

filename = '/Users/shashikantrai/Downloads/example.xls'

book = Spreadsheet.open(filename)

sheet1 = book.worksheet 0

sheet1.each 1 do |row|
puts "#{row[0]}"
puts "#{row[1]}"
puts "#{row[2]}"
end

book.io.close


En esta página del sitio puede ver el video en línea How to read data from an excel file using ruby de Duración hora minuto segunda en buena calidad , que subió el usuario Shashikant Rai 29 agosto 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 1,223 veces y le gustó 13 a los espectadores. Disfruta viendo!