Accessing Excel in Ruby

Accessing Excel in Ruby

CODE:

require ‘win32ole’
excel = WIN32OLE.new(‘excel.application’)
excel.visible = true
work=excel.workbooks.open(“C:\\Documents and Settings\\raveendran\\Desktop\\output.xls”)
excel.range(“A1”).value = “name”
excel.range(“B1”).value = “address”
excel.range(“C1”).value = “city ”
excel.range(“D1”).value = “state ”
excel.range(“E1”).value = “zip”
work.save

OUPUT:

Excel

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s