views:

172

answers:

3

Is it possible to deliver an Excel Spreadsheet via an Web Service. I believe not as ASP.NET web services seem only to deal in Serializable elements which the excel binary format isn't (I think). If the Excel is saved in XML format will this work?

I have a number of reports that will be emailed, but the request has been put into allow these reports to be pulled via Web Services.

Is this achievable?

A: 

I wouldn't try. An Excel spreadsheet has a great deal of overhead associated with formatting, and so on. I'd be tempted to send just the data over the wire. If it absolutely has to be a spreadsheet at the receiving end, then a little bit more coding could format the data as such.

Another alternative to this would be just to make the spreadsheet files available for a direct download. The fact you are hosting web services implies that you are using a web server of some kind, so WebClient.DownloadFile should be available. Your web service could then supply the URL of the latest file.

*edit - Eoin Campbell's answer below will allow you to take your preferred route, if you still desire.

ZombieSheep
This makes perfect sense!
Codex
+5  A: 

Yep. You can just open the excel files as memory streams on the server and stream them to the client/consumer as a byte []. The client can then just save the file stream back to the local machine.

MS have a knowledge base article on it.

http://support.microsoft.com/kb/318425

Eoin Campbell
A: 

you could serialize the excel file by turning it into a mime encoded string, using base64 or some of the other alternatives.

same sort of way attachments are embedded in emails.

Of course the client would need to know that it is expecting a mime encoded string, and which decoding type to use

bumperbox