How to read data from an excel file using ruby

Pubblicato il: 29 agosto 2022
sul canale di: 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


In questa pagina del sito puoi guardare il video online How to read data from an excel file using ruby della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Shashikant Rai 29 agosto 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,223 volte e gli è piaciuto 13 spettatori. Buona visione!