Currency Format

33 views
Skip to first unread message

Bluebells

unread,
Aug 10, 2011, 2:10:26 PM8/10/11
to ruby-roo
Hi,

I have a column in my excel which is formatted with type currency.
When I convert that xlsx file to csv, I loose the format. I tried
adding that format to excelx.rb file but still no effect. How do I
preserve the currency format in my generated csv and also commas.

e.g.
1. In .xlsx, I have $0.24 rounded to 2 decimal places. While the csv
looses the $ and makes it 0.24562345
2. In .xlsx, I have 12,345 while the csv looses the , and makes it
12345.

Thanks,
Kajal

Thomas Preymesser

unread,
Aug 14, 2011, 5:18:01 AM8/14/11
to ruby...@googlegroups.com
Hello Kajal,

On 10 August 2011 20:10, Bluebells <aggrawa...@gmail.com> wrote:
e.g.
1. In .xlsx, I have $0.24 rounded to 2 decimal places. While the csv
looses the $ and makes it 0.24562345
2. In .xlsx, I have 12,345 while the csv looses the , and makes it
12345.


Roo is not a spreadsheet application. Roo does not use the format definitions, it takes only the raw values of the spreadsheet cells.

-Thomas

joedio

unread,
Sep 14, 2011, 9:07:59 AM9/14/11
to ruby-roo
To further clarify, the CSV file does not support formats, it is a
collection of Comma Separated Values.

Open a CSV file in Notepad or any other text editor and you'll see
this.

Thus when you export from Excel you loose any formatting.
If you need the values from a Spreadsheet, that was exported to CSV,
formatted in a specific way you will need to re-apply that formatting
in your Ruby
code after reading in the csv file.

Joe


On Aug 14, 3:18 am, Thomas Preymesser <tho...@gmail.com> wrote:
> Hello Kajal,
>
Reply all
Reply to author
Forward
0 new messages