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!)
Recent Comments