Spreadsheet Date format

Hello,

I’m trying to use the Spreadsheet library to create a spreadsheet.
Since I’m rather new to Ruby, I’m running into problems. :slight_smile:

Version → spreadsheet (0.6.4.1)

What I’m trying to do is set a “date” format in all the cells of a
column. I can’t seem to find anywhere how to set the date though…

I’ve tried to infer from Float in Spreadsheet - Ruby - Ruby-Forum how
to do so…

book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet
sheet1.name = ‘test’
date_format = Spreadsheet::Format.new(:number_format => ‘??what goes
here??’)
sheet1.format_column, date_format ← this is syntactically wrong?

or what is the correct way to set a date format?

Any help would be appreciated!

Regards
Brandon

It helps to read the documentation… :slight_smile:
http://spreadsheet.rubyforge.org/GUIDE_txt.html

Under “Date and DateTime”

Reg Exes wrote:

Hello,

I’m trying to use the Spreadsheet library to create a spreadsheet.
Since I’m rather new to Ruby, I’m running into problems. :slight_smile:

Version → spreadsheet (0.6.4.1)

What I’m trying to do is set a “date” format in all the cells of a
column. I can’t seem to find anywhere how to set the date though…

I’ve tried to infer from Float in Spreadsheet - Ruby - Ruby-Forum how
to do so…

book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet
sheet1.name = ‘test’
date_format = Spreadsheet::Format.new(:number_format => ‘??what goes
here??’)
sheet1.format_column, date_format ← this is syntactically wrong?

or what is the correct way to set a date format?

Any help would be appreciated!

Regards
Brandon

Hello,

To fix the date format of spreadsheet by specifying.
Spreadsheet::Format.new(:number_format => ‘DD/MM/YY’)

Thanks,
Priyanka P.