The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Simple Office 2007 Excel file to CSV hack

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Andrew Montgomery

Posts: 42
Nickname: darkliquid
Registered: Sep, 2006

Andrew Montgomery is a lead developer for UK-based web development company SonicIQ
Simple Office 2007 Excel file to CSV hack Posted: Oct 31, 2008 10:13 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Andrew Montgomery.
Original Post: Simple Office 2007 Excel file to CSV hack
Feed Title: Dark Liquid - Ruby
Feed URL: http://feeds.feedburner.com/DarkLiquid-Ruby
Feed Description: Ruby and Rails related ramblings by Andrew Montgomery
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Andrew Montgomery
Latest Posts From Dark Liquid - Ruby

Advertisement
I needed to convert a very simple Office 2007 Excel file into a CSV. I don’t have Office 2007 so I hacked up some Ruby goodness to convert it. require 'rubygems' require 'hpricot' doc = open('office2007.xls') { |f| Hpricot(f) } csv = '' doc.search('//row').each do |row| (row/'cell/data').each do |data| csv < < "\"#{data.to_plain_text}\"," if data end csv.chomp!(',') csv

Read: Simple Office 2007 Excel file to CSV hack

Topic: Textile toolbar plugin for Rails Previous Topic   Next Topic Topic: A quick Rails benchmark

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use