views:

29

answers:

2

Hello

Today I started using the spreadsheet gem to make my excel files, but one of my column is a date, and I want to format this column as a date. It looks like it is in there somewhere, with the date method in Spreadsheet::Excel::Row, but I can't make it work.

Any hero out there?

A: 

I think there is no option of date fotmat . you shold do maunally.

A: 

Actually did figure it out, with the Spreadsheet:Format you have a option of :number_format

So I now I'm using this code

date = Spreadsheet::Format.new :number_format => 'MM/DD/YYYY'
...
sheet.row(i).set_format(0, date)
...
sheet[i, 0] = Date.today
Terw