title: With Ruby Spreadsheet gem, can I format a cell as currency?
body: <p>The relevant code within the action is below:</p>
  
  <pre><code># XLS
  book = Spreadsheet::Workbook.new
  sheet1 = book.create_worksheet
  currency_format = Spreadsheet::Format.new :number_format =&gt; '0.00'
  
  sheet1.row(0).concat 'Example header', 'Example header 2', 'Example header 3'
  
  
  
      @transactions.each_with_index do |tx, index|
  
        row = sheet1.row(index + 1)
        row.push tx.attr1, tx.attr2, tx.attr3      
        row.set_format(1, currency_format)
        row.set_format(2, currency_format)
  
      end
  
  
  data = StringIO.new '';
  book.write data
  
  
  respond_to do |format|
    format.xls { send_data data.string, :disposition =&gt; "attachment; filename=transactions.xls" }
  end
  </code></pre>
  
  <p>It exports okay, and I can format the cells as numbers, but Excel (on the Mac) is not allowing me to total up the values in the number formatted column. Can I choose <em>currency</em> format?</p>
  
  <p>Thanks</p>