# Help in the excel

**URL:** <https://www.ruby-forum.com/t/help-in-the-excel/136161>\
**Category:** Ruby\
**Created:** [April 29, 2008, 2:39pm UTC](https://www.ruby-forum.com/t/help-in-the-excel/136161 "2008-04-29T14:39:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pranjal\_jain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@pranjal\_jain](https://www.ruby-forum.com/u/pranjal_jain)\
**Post date:** [April 29, 2008, 2:39pm UTC](https://www.ruby-forum.com/t/help-in-the-excel/136161/1 "2008-04-29T14:39:07Z")

</div>

HI All  
I want to insert the data into the Excel sheet, but I wish the data to  
be inserted in Excel Sheet is not in black color but in green color.  
I had tried the following code for it, but it is not working.

Can anybody has the solution for it.

$worksheet.Range(“c#{b+1}”).Value = “Login page  
verified.”.colorize(:green)  
puts “\nWeb page opened successfully\n”.colorize(:green)

Thankx in advance 🙂

---

<div class="post-metadata">

**Author:** ![pranjal\_jain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@pranjal\_jain](https://www.ruby-forum.com/u/pranjal_jain)\
**Post date:** [April 29, 2008, 2:58pm UTC](https://www.ruby-forum.com/t/help-in-the-excel/136161/2 "2008-04-29T14:58:36Z")

</div>

Pranjal J. wrote:

> HI All  
> I want to insert the data into the Excel sheet, but I wish the data to  
> be inserted in Excel Sheet is not in black color but in green color.  
> I had tried the following code for it, but it is not working.
> 
> Can anybody has the solution for it.
> 
> $worksheet.Range(“c#{b+1}”).Value = “Login page  
> verified.”.colorize(:green)  
> puts “\nWeb page opened successfully\n”.colorize(:green)
> 
> Thankx in advance 🙂

Set the .Font.ColorIndex value of your range:

$worksheet.Range(“c#{b+1}”).Font.ColorIndex = 50

More color index values here:

[Return Excel Color Index Number or Color as Text. Excel VBA Custom Formula](http://www.ozgrid.com/VBA/ReturnCellColor.htm)

Hope that helps.

David

> **[Ruby on Windows](http://rubyonwindows.blogspot.com)**
>
> On using the Ruby programming language on the Microsoft Windows platform
