p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_components thread: Need help pulling a Recordset into Excel sheet via ASP page.


Message #1 by "Aimee Newell" <aimee@m...> on Wed, 28 Mar 2001 21:32:42
I need to perform the following on an ASP page when it is requested and 

the Excel file does not exist for the particular publication:



*Pull a recordset of Authors associated with a publication (includes 

fields such as First Name, Last Name, Company, Address, etc.).  There will 

be a different amount of records (authors) each time this is run based on 

some parameters. (I've already got the code for this.)



*Then I need to write this information into an Excel spreadsheet. (This is 

the part I don't know how to do.)



*Finally I need to provide a link to download this spreadsheet. (I can do 

this.)



Thanks in advance,

Aimee
Message #2 by John Covert <johnc@a...> on Wed, 28 Mar 2001 17:05:51 -0500
Aimee,



I believe that a search of MSDN's Knowledge Base will reveal that Excel

automation on an unattended server box is neither supported nor recommended.

We just tackled this issue this week, and decided to write our ADO data to a

CSV file which could then be downloaded and imported by (or opened, by

Windows default, with) Excel.



I hope that helps.



Regards,



John Covert

Accountable Software

xxx.xxx.xxxx  x16

mailto:JohnC@A...



Accountable Software, Inc.

http://www.accountable.com

412 Creamery Way, Suite 100

Exton, PA  19341-2500

Tel:  xxx.xxx.xxxx 

Fax:  xxx.xxx.xxxx



2000 Accounting Today Technology Pacesetter

2000 Deloitte & Touche Technology Fast 500

1999 & 2000 Excellence in Integration Award

Great Plains 1998 Global Developer of the Year







-----Original Message-----

From: Aimee Newell [mailto:aimee@m...]

Sent: Thursday, March 29, 2001 4:18 AM

To: ASP components

Subject: [asp_components] Need help pulling a Recordset into Excel sheet

via ASP page.





I need to perform the following on an ASP page when it is requested and 

the Excel file does not exist for the particular publication:



*Pull a recordset of Authors associated with a publication (includes 

fields such as First Name, Last Name, Company, Address, etc.).  There will 

be a different amount of records (authors) each time this is run based on 

some parameters. (I've already got the code for this.)



*Then I need to write this information into an Excel spreadsheet. (This is 

the part I don't know how to do.)



*Finally I need to provide a link to download this spreadsheet. (I can do 

this.)



Thanks in advance,

Aimee



Message #3 by Morris Andrew-AMORRIS1 <AMORRIS1@m...> on Thu, 29 Mar 2001 11:14:34 +0100
However, you can use and ADO connection to Excel instead of Excel

objects...!

This is how to insert data into a spreadsheet from  ASP.



Set con = CreateObject("ADODB.Connection")



With con

    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data

Source=c:\test.xls;Extended Properties=Excel 8.0"

    .Open

End With





con.Execute "INSERT INTO [Sheet1$] VALUES(""hello"")"



con.Close



Obviously replace the "c:\test.xls" with your filename, and the Sheet names

and data.

I don't think this will create the spreadsheet file though - have an empty

file to start with. You might have to think of a clever way of dynamically

naming the files if different users want concurrently different files!

Good luck and hope this helps

Andy



-----Original Message-----

From: John Covert [mailto:johnc@a...]

Sent: 28 March 2001 23:06

To: ASP components

Subject: [asp_components] RE: Need help pulling a Recordset into Excel

she et via ASP page.





Aimee,



I believe that a search of MSDN's Knowledge Base will reveal that Excel

automation on an unattended server box is neither supported nor recommended.

We just tackled this issue this week, and decided to write our ADO data to a

CSV file which could then be downloaded and imported by (or opened, by

Windows default, with) Excel.



I hope that helps.



Regards,



John Covert

Accountable Software

xxx.xxx.xxxx  x16

mailto:JohnC@A...



Accountable Software, Inc.

http://www.accountable.com

412 Creamery Way, Suite 100

Exton, PA  19341-2500

Tel:  xxx.xxx.xxxx 

Fax:  xxx.xxx.xxxx



2000 Accounting Today Technology Pacesetter

2000 Deloitte & Touche Technology Fast 500

1999 & 2000 Excellence in Integration Award

Great Plains 1998 Global Developer of the Year







-----Original Message-----

From: Aimee Newell [mailto:aimee@m...]

Sent: Thursday, March 29, 2001 4:18 AM

To: ASP components

Subject: [asp_components] Need help pulling a Recordset into Excel sheet

via ASP page.





I need to perform the following on an ASP page when it is requested and 

the Excel file does not exist for the particular publication:



*Pull a recordset of Authors associated with a publication (includes 

fields such as First Name, Last Name, Company, Address, etc.).  There will 

be a different amount of records (authors) each time this is run based on 

some parameters. (I've already got the code for this.)



*Then I need to write this information into an Excel spreadsheet. (This is 

the part I don't know how to do.)



*Finally I need to provide a link to download this spreadsheet. (I can do 

this.)



Thanks in advance,

Aimee




  Return to Index