Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Write hyperlinks using spreadsheet gem in Ruby?

The spreadsheet gem isnt documented properly, so I cant understand how can I write hyperlinks using spreadsheet gem. Can anyone tell me?

like image 661
Shubham Avatar asked Jul 25 '10 03:07

Shubham


2 Answers

This script will create a spreadsheet with a link in the first cell

require 'rubygems'
require 'spreadsheet'

book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet
sheet1[0,0] = Spreadsheet::Link.new 'www.google.com', 'link text'
book.write '/tmp/spreadsheet_with_link.xls'
like image 107
opsb Avatar answered Nov 17 '22 00:11

opsb


According to the Guide you have to write to a new file name: https://github.com/zdavatz/spreadsheet/blob/master/GUIDE.md

like image 40
zdavatz Avatar answered Nov 16 '22 23:11

zdavatz