We use cookies to keep our site relevant and easy to use, your continued use of this site is consent that we may set several cookies (see our Privacy & Cookie Policy), click to always allow cookies from our site (and not see this notifcation on your next visit) or read more.Allow Cookies

EU legislation requires that all websites clearly specify if cookies are being used and their purpose, You can read more about how we use cookies (and which cookies we use) in our Privacy and Cookie Policy.

You will see this notification the first time you visit our website unless you accept cookies (in which case we'll set a cookie to remember thay you're happy for us to to set cookies!).

Creating Excel Spreadsheets on the Fly!

I was shown this yesterday, I’ve always exported stuff to CSV and then re-imported it when I’ve wanted to get an Excel Spreadsheet out of my webserver

When you are sending your response content-type back simply return a table with the response type set as:

  • application/vnd.ms-excel

You can even return formulas in this way by making one of the table cells similar to:

  • =SUM(F2:F3)

(obviously that requires a little more thought and working out where things are going to go in tables.)

NOTE: Put a border round your cells or else they’ll all come out blank with just the data in (i.e. gridlines off!)

This entry was posted on Thursday, February 15th, 2007 at 4:11 pm and is filed under Software. You can follow any responses to this entry through the RSS 2.0 feed.

Comments are closed.