Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. irb(main):001:0> require "roo"
  2. => true
  3. irb(main):002:0> Roo::VERSION
  4. => "2.7.1"
  5. irb(main):003:0> file = "/path/to/with_hyperlink_sample.xlsx"
  6. => "/path/to/with_hyperlink_sample.xlsx"
  7. irb(main):004:0> excel = Roo::Excelx.new(file)
  8. => <#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>
  9. irb(main):005:0> excel.map(&:itself)
  10. => [["mail"], ["example001@example.com"], ["example002@example.com"]]
  11. irb(main):006:0> excel.sheet_for(nil).hyperlinks
  12. => {[2, 1]=>"mailto:example001@example.com", [3, 1]=>"mailto:example002@example.com"}
  13. irb(main):007:0> excel.to_csv
  14. => "\"mail\"\n\"mailto:example001@example.com\"\n\"mailto:example002@example.com\"\n"
  15. irb(main):008:0> excel.row(2).to_csv
  16. => "example001@example.com\n"
  17. irb(main):009:0> excel.column(1).to_csv
  18. => "mail,example001@example.com,example002@example.com\n"
  19. irb(main):010:0> excel.to_yaml
  20. => "--- \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"
  21. # ---
  22. # cell_1_1:
  23. # row: 1
  24. # col: 1
  25. # celltype: string
  26. # value: mail
  27. # cell_2_1:
  28. # row: 2
  29. # col: 1
  30. # celltype: link
  31. # value: example001@example.com
  32. # cell_3_1:
  33. # row: 3
  34. # col: 1
  35. # celltype: link
  36. # value: example002@example.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement