Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irb(main):001:0> require "roo"
- => true
- irb(main):002:0> Roo::VERSION
- => "2.7.1"
- irb(main):003:0> file = "/path/to/with_hyperlink_sample.xlsx"
- => "/path/to/with_hyperlink_sample.xlsx"
- irb(main):004:0> excel = Roo::Excelx.new(file)
- => <#Roo::Excelx:1777751165347360 @tmpdir @shared @filename @sheet_files @sheet_names @sheets @sheets_by_name @options @cell @cell_type @cells_read @first_row @last_row @first_column @last_column @header_line>
- irb(main):005:0> excel.map(&:itself)
- => [["mail"], ["example001@example.com"], ["example002@example.com"]]
- irb(main):006:0> excel.sheet_for(nil).hyperlinks
- => {[2, 1]=>"mailto:example001@example.com", [3, 1]=>"mailto:example002@example.com"}
- irb(main):007:0> excel.to_csv
- => "\"mail\"\n\"mailto:example001@example.com\"\n\"mailto:example002@example.com\"\n"
- irb(main):008:0> excel.row(2).to_csv
- => "example001@example.com\n"
- irb(main):009:0> excel.column(1).to_csv
- => "mail,example001@example.com,example002@example.com\n"
- irb(main):010:0> excel.to_yaml
- => "--- \ncell_1_1: \n row: 1 \n col: 1 \n celltype: string \n value: mail \ncell_2_1: \n row: 2 \n col: 1 \n celltype: link \n value: example001@example.com \ncell_3_1: \n row: 3 \n col: 1 \n celltype: link \n value: example002@example.com \n"
- # ---
- # cell_1_1:
- # row: 1
- # col: 1
- # celltype: string
- # value: mail
- # cell_2_1:
- # row: 2
- # col: 1
- # celltype: link
- # value: example001@example.com
- # cell_3_1:
- # row: 3
- # col: 1
- # celltype: link
- # value: example002@example.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement