Simple Excel exports
January 26, 2006 on 11:42 pm | In Coding | No CommentsGot some data that you need to transfer into Excel, but ODBC doesn’t fit the bill? Then why don’t you try the new and improved Excel XML format. As far as I am aware, it’s good for Excel 2000 and above:
<?xml version="1.0"?>
<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Worksheet ss:Name="First Sheet">
<ss:Table>
<ss:Column ss:Width="100"/>
<ss:Column ss:Width="200"/>
<ss:Row>
<ss:Cell><ss:Data ss:Type="String">Field 1</ss:Data></ss:Cell>
<ss:Cell><ss:Data ss:Type="String">Field 2</ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell><ss:Data ss:Type="String">First row</ss:Data></ss:Cell>
<ss:Cell><ss:Data ss:Type="Number">1</ss:Data></ss:Cell>
</ss:Row>
<ss:Row>
<ss:Cell><ss:Data ss:Type="String">Second Row</ss:Data></ss:Cell>
<ss:Cell><ss:Data ss:Type="Number">2</ss:Data></ss:Cell>
</ss:Row>
</ss:Table>
</ss:Worksheet>
</ss:Workbook>
It’s fast, it’s simple, it works with anything that can spit out XML (so just about anything then) and the result looks like more work than just a few lines of XML, but with 99% less code than writing to the binary XLS format, it’s a sure winner.
No Comments yet
Sorry, the comment form is closed at this time.
Powered by WordPress with custom theme based on "Pool" by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^