Exporting data from SQL Server to Excel

winsonlee
07-14-2002, 10:29 PM
Anyway i can exports data from SQL Server to Excel through ASP ? If it is possible, can i know how it can be done ??

ashish908
07-24-2002, 05:58 AM
you can write an asp script which takes all the data from the sql server and then use filesystemobject to create a file by some name ***.xls and write the data into the file in the csv format.

Now that file can be opened in Excel, though it will ask to specify some information on conversion (eg. delimiter and stuff like that) when u try to open the file.

darkforcesjedi
07-24-2002, 02:26 PM
If excel is installed on your server, you can output it straight to an excel sheet. (At least you can in Visual Basic, I haven't tried in ASP.)

Dim ExcelSheet
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Cells(1,1).Value = "This is column A, row 1"
ExcelSheet.SaveAs "C:\DOCS\TEST.XLS"
ExcelSheet.Application.Quit
Set ExcelSheet = Nothing

Rezner
07-24-2002, 02:28 PM
My solution is similar to ashish908's except that I'd use the Excel object directly in ASP. With it, you can create a spreadsheet and set its contents programmatically from ASP. I'm not an expert in this area so, if I were you, I'd post in the VBA forum for help on this.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum