1

I need to generate XLS file using TSQL only. I am generating XML based Excel. I am trying to use FOR XML for this but as the output XLS file is fairly complex its taking much efforts and time.

Is there any other way to do it? Or if its only way what's that can i do to do it effectively ?

It is not about exporting the data. I will respond to the user in XML format and that XML format will be opened by Excel(I will include headers that Excel know and will open the result in Excel.) User or I will not have direct access to SQL server so no way to export the results.The query will be exposed as Web-service. User will request the data and application will respond with XML that will be opened in Excel.

Nimble Fungus
  • 513
  • 3
  • 22
  • You can always use SSIS, but you can achieve almost everything using `FOR XML EXPLICIT` – Lukasz Szozda Dec 02 '15 at 15:36
  • 2
    Possible duplicate of [Export SQL query data to Excel](http://stackoverflow.com/questions/7389637/export-sql-query-data-to-excel) – iDevlop Dec 02 '15 at 15:38
  • 3
    If you produce a tab or comma delimited file and name it with a `.xls` extension, excel will be happy to open it across all of it's version. – JNevill Dec 02 '15 at 15:39
  • 1
    The process of creating a full XLS file is complex -- very complex. You should create a CSV file with .xls extension or purchase a 3rd party library to help make the file -- this will always be cheaper than rolling your own. The CSV file meets almost everyone's needs I've found. – Hogan Dec 02 '15 at 16:17
  • @Hogan is it possible to create a XML with multiple sheet using CSV ?? – Nimble Fungus Dec 02 '15 at 18:14
  • @NimbleFungus not as far as I know. – Hogan Dec 02 '15 at 18:39

0 Answers0