Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 20th, 2004, 01:53 PM
Registered User
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to jewbask Send a message via MSN to jewbask Send a message via Yahoo to jewbask
Default creating Multisheet Excel files

Guys (and girls),

   How do I create a Multisheet Excel file using ASP, retrieving the data from a SQL Server? I already know how to do it, but only works for single-sheet files

   thanks in advance,

Carlos Manuel Colina
Junior Web Developer
Multipuerta, CA
phone: +58 212 2066314
SMS/mobile: +58 412 6139001
Old July 20th, 2004, 06:03 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post

check out http://www.greggriffiths.org/webdev/both/excel/ which covers automating Excel via ASP, it should provide some tips and links for you.
Old July 21st, 2004, 12:07 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp

You can create new worksheets in an excel file through ASP. You can treat a worksheet as a table. You can run a create table statement with connection object to create new excel sheets. Here is a sample script.

Dim cnn_xls
Set cnn_xls = Server.CreateObject("ADODB.Connection")
With cnn_xls
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "Data Source=" & Server.MapPath(".") & "\sample.xls" & ";" & _
            "Extended Properties=""Excel 8.0;"""
End With
dim qry_create_sheet
qry_create_sheet="CREATE TABLE [Report_sheet] (Col1 text(10), Col2 text(10), Col3 text(30), Col4 Number)"
cnn_xls.Execute qry_create_sheet
Response.Write("New worksheet created")

To run this :

Put an excel file by name sample.xls in the same directory as the script.

After running, you can see that one worksheet in the name Report_sheet is created in that excel file.

Running this for a second time will create an error as there is already a worksheet with name Report_sheet.

Best wishes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating Excel FIles from resource Files abinashpatra ASP.NET 1.0 and 1.1 Basics 0 July 28th, 2008 02:07 AM
Merge many excel files into one excel files Roshanjoshi2001 Excel VBA 2 November 14th, 2007 06:23 PM
Need help w/ creating PDF files in Excel ArtDecade VB.NET 2002/2003 Basics 2 June 14th, 2006 11:06 PM
Creating Files xchemicalbeatz VB.NET 2002/2003 Basics 6 April 14th, 2005 08:24 AM
Reading/Creating/Writing Excel FIles p_nut33 C# 1 September 2nd, 2003 12:17 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.