Accessing an Excel spreadsheet using ASP 
Author Message
 Accessing an Excel spreadsheet using ASP

Hi,

I'm trying to write some script to access an Excel spreadsheet through an
ASP page.  Just wanted to know:

1) Can I do it?
2) If so, then could someone give me some direction on how to proceed?

I am creating the pages locally on PWS for Win98 to set up the pages and
test the script and this how far I am now:

<%
Option Explicit
Response.Expires = 0
Dim objConn, ObjRS, strQuery, strConnection
Set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "DSN=workbook1;"
strConnection = strConnection & "UID=;PWD;"
objConn.Open strConnection

Now I am stuck.  I know I should be using a database, but I have my reasons
=).  Any help on how to proceed would be appreciated.

-Rob



Mon, 29 Mar 2004 02:18:01 GMT  
 Accessing an Excel spreadsheet using ASP
THE FOLLOWING OPENS UP THE EXCEL FILE, EDITS SOME CELLS ON THE WORKSHEET,
GETS INFORMATION FROM CELLS, AND RUNS A MACRO THAT EXPORTS A CHART AS A GIF
IMAGE. WHAT I'M DOING IS UPDATING A WORKSHEET FROM USER FORM INPUT, THEN
UPDATING THE WEB PAGE WITH THE NEW DATA AND CHART IMAGE!

Set xlApp = CreateObject("excel.application")

xlApp.Visible = True
xlApp.Application.DisplayAlerts = False
xlApp.Workbooks.Open"C:\yourfile.xls"
xlApp.Worksheets("Sheet1").Cells(500, 10) = RandNum
xlApp.Worksheets("Sheet1").Cells(8, 6) = Session("UniqueNum")
xlApp.Worksheets("Sheet1").Cells(9, 6) = Session("PagesNum")
Cell7 = xlApp.Worksheets("Sheet1").Cells(17, 2).value
Cell8 = xlApp.Worksheets("Sheet1").Cells(17, 4).value
Cell19 = FormatCurrency(Cell19,0,-1,-1,-1)
Cell20 = xlApp.Worksheets("Sheet1").Cells(30, 4).value
Cell20 = FormatCurrency(Cell20,0,-1,-1,-1)
Cell21 = xlApp.Worksheets("Sheet1").Cells(30, 6).value
Cell21 = FormatCurrency(Cell21,0,-1,-1,-1)
Cell46 = xlApp.Worksheets("Sheet1").Cells(42, 8).value
Cell46 = FormatCurrency(Cell46,0,-1,-1,-1)
Cell47 = xlApp.Worksheets("Sheet1").Cells(42, 10).value
Cell47 = FormatCurrency(Cell47,0,-1,-1,-1)
Cell48 = xlApp.Worksheets("Sheet1").Cells(42, 12).value
Cell48 = FormatCurrency(Cell48,0,-1,-1,-1)
xlApp.Application.Run("Create_GIF")
xlApp.Quit
Set xlApp = Nothing

-Curtis


Quote:
> Hi,

> I'm trying to write some script to access an Excel spreadsheet through an
> ASP page.  Just wanted to know:

> 1) Can I do it?
> 2) If so, then could someone give me some direction on how to proceed?

> I am creating the pages locally on PWS for Win98 to set up the pages and
> test the script and this how far I am now:

> <%
> Option Explicit
> Response.Expires = 0
> Dim objConn, ObjRS, strQuery, strConnection
> Set objConn = Server.CreateObject("ADODB.Connection")
> strConnection = "DSN=workbook1;"
> strConnection = strConnection & "UID=;PWD;"
> objConn.Open strConnection

> Now I am stuck.  I know I should be using a database, but I have my
reasons
> =).  Any help on how to proceed would be appreciated.

> -Rob



Tue, 30 Mar 2004 01:44:45 GMT  
 Accessing an Excel spreadsheet using ASP
HOWTO: Use ADO with Excel Data from Visual Basic or VBA (Q257819)
http://support.microsoft.com/support/kb/articles/Q257/8/19.ASP

The examples are early bound VB/VBA but are easily converted to late bound VBScript...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> Hi,

> I'm trying to write some script to access an Excel spreadsheet through an
> ASP page.  Just wanted to know:

> 1) Can I do it?
> 2) If so, then could someone give me some direction on how to proceed?

> I am creating the pages locally on PWS for Win98 to set up the pages and
> test the script and this how far I am now:

> <%
> Option Explicit
> Response.Expires = 0
> Dim objConn, ObjRS, strQuery, strConnection
> Set objConn = Server.CreateObject("ADODB.Connection")
> strConnection = "DSN=workbook1;"
> strConnection = strConnection & "UID=;PWD;"
> objConn.Open strConnection

> Now I am stuck.  I know I should be using a database, but I have my reasons
> =).  Any help on how to proceed would be appreciated.

> -Rob



Tue, 30 Mar 2004 01:54:38 GMT  
 Accessing an Excel spreadsheet using ASP
Thanks guys.  That really helps me out a lot.



HOWTO: Use ADO with Excel Data from Visual Basic or VBA (Q257819)
http://support.microsoft.com/support/kb/articles/Q257/8/19.ASP

The examples are early bound VB/VBA but are easily converted to late bound
vbscript...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> Hi,

> I'm trying to write some script to access an Excel spreadsheet through an
> ASP page.  Just wanted to know:

> 1) Can I do it?
> 2) If so, then could someone give me some direction on how to proceed?

> I am creating the pages locally on PWS for Win98 to set up the pages and
> test the script and this how far I am now:

> <%
> Option Explicit
> Response.Expires = 0
> Dim objConn, ObjRS, strQuery, strConnection
> Set objConn = Server.CreateObject("ADODB.Connection")
> strConnection = "DSN=workbook1;"
> strConnection = strConnection & "UID=;PWD;"
> objConn.Open strConnection

> Now I am stuck.  I know I should be using a database, but I have my
reasons
> =).  Any help on how to proceed would be appreciated.

> -Rob



Tue, 30 Mar 2004 03:46:10 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Access an excel spreadsheet through asp?

2. linking an excel spreadsheet to an access database using vb

3. Open excel spreadsheet from within Access using VBA

4. Excel spreadsheet from an Access database using VB?

5. Importing Excel Spreadsheet into an Access 2000 Table using VB

6. linking an excel spreadsheet to an access table using vb

7. Save embedded excel spreadsheet in access to excel file

8. Convert Excel or Access spreadsheet to INI file format

9. Accessing Excel Spreadsheet from Web Server

10. using data in an excel spreadsheet

11. Read Excel Spreadsheet in VBScript using ADO

12. Using either a CSV or Excel Spreadsheet in VBScript

 

 
Powered by phpBB® Forum Software