Failed to create Excel using spreadsheet (Ruby)

An attempt to create an excel style - the color of ruby background row of the table , but nothing happens to me -

Here is my code -

My formats:

pass_format = Spreadsheet::Format.new :color=> :blue, :pattern_fg_color => :green, :pattern => 1
fail_format = Spreadsheet::Format.new :color=> :blue, :pattern_fg_color => :red, :pattern => 1
skip_format = Spreadsheet::Format.new :color=> :blue, :pattern_fg_color => :yellow, :pattern => 1

Trying to use them here (just showing one rest is determined by if elses):

sheet1.row(counter).default_format = skip_format
sheet1[counter, 3] = 'Skipped'
sheet1.row(counter).default_format = skip_format
sheet1.row(counter).set_format(3, skip_format)

The counter is the line I'm in now. Here I am not sure whether to format or write first. What am I doing wrong? How to fix it?

This actually applies as I found from .inspect -

#<Spreadsheet::Format:0x007f082f9c1d58 @font=#<Spreadsheet::Font:0x007f082f9c1a88 @name="Arial", @color=:red, @previous_fast_key=nil, @size=nil, @weight=nil, @italic=nil, @strikeout=nil, @outline=nil, @shadow=nil, @escapement=nil, @underline=nil, @family=:swiss, @encoding=nil>, @number_format="GENERAL", @rotation=0, @pattern=1, @bottom_color=:black, @top_color=:black, @left_color=:black, @right_color=:black, @diagonal_color=:black, @pattern_fg_color=:yellow, @pattern_bg_color=:pattern_bg, @regexes={:date=>/[YMD]/, :date_or_time=>/[hmsYMD]/, :datetime=>/([YMD].*[HS])|([HS].*[YMD])/, :time=>/[hms]/, :number=>/[#]/}, @used_merge=0>

but even if it shows red here, in black .: (

I edit the source file and then write in a new file as

 book.write "Result.xls"

Is this the wrong approach? Before editing and updating, I will try to create a new book.

0
1

, excel, Excel. . excel ( , excel), , ,

book.write "xxx.xls"

0

All Articles