Converting CSV to XML

There’s a bit a functionality on one of the projects that I’m working on where I need to do a lookup. The data I’ve been given is in an Excel spreadsheet – which I needed to convert to XML (as ultimately the data will be stored in a CMS that handles XML better).

I’ve done a lot of projects where I need to convert XML to Excel (via CSV), but not many where I need to convert the other way.

I first saved the Excel as an “XML Spreadsheet” – which spat out all sorts of extra MS Office namespaces, styles, etc. Which is fine if I want to re-open the data in Excel. But I wanted the data to be cleaner (and more semantic).

I exported the Excel out as a CSV; then looked for a way to convert it to XML.

Then I found this very useful web-app tool: CSV to XML Converter by Creativyst

It did exactly what I needed! The tool has a 100Kb limit – which was great, because my CSV was 96Kb!

The outputted XML was around 450Kb – which got me thinking… if a lot of developers use that tool the way I did – then that’s a lot of load on their web-server! Maybe that’s where the new Google App Engine could come in handy?! They have the processing power and bandwidth to handle high usage!

I’d love to see other online text conversion utilities … you never know, maybe they could be all centralised on Google Apps?

4 thoughts on “Converting CSV to XML

  1. Another alternative is to use ADO.Net to query the Excel spreadsheet (SELECT * FROM [Sheet1] or whatever) and then just serialise the resulting dataset. Just a thought and nowhere near as much fun as GAE is turning out to be :)

  2. Oooh, are you playing with Google Apps… uh-uh, can I see, can I see?

    I don’t know enough Python to play with it yet!
    I reckon once they get a PHP version rolled-out, it’s gonna explode!

  3. Do you mean explode as in excessive resource usage ? ;)

    There are lots of people complaining about GAE, but so far I’m loving it, but doing something that requires lat/lon to be input means I need client software – but this darn iPhone SDK is taking forever to download :)

  4. Explode in usage and popularity, especially if it remains “free” (as in beer).

    I forgot to say thanks for the ADO.Net tip yesterday too! (got too excited asking about GAE)

    Keep me posted with how you get on with the app!