ASP TO EXCELL

This is a discussion on "ASP TO EXCELL" within the Classic ASP section. This forum, and the thread "ASP TO EXCELL are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1  
Old Apr 3rd, 2005, 16:00
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
ASP TO EXCELL

hai everyone...
I wonder if an asp page can interact with excell page?

I have desing an excel page that I used tu input STUDENT NAME and their EXAM MARK (0% TO 100%), later it will display some statistic in the bottom of the page, such as HOW MANY GETS AN 'A' OR HOW MANY FAILED ETC...
Now, i was wondering if i could design an asp page with two input text field that will be used to input STUDENT NAME and their EXAM MARK (fixed 30 list of student), and then submit the page, the data will be sent to the excel page that i have created earlier.

anybody have a better idea?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Apr 3rd, 2005, 16:14
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,158
Blog Entries: 7
Thanks: 27
Thanked 19 Times in 16 Posts
Why not use an access database with those two fields?

You can then create a CSV file from the results and import that into Excel.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Apr 3rd, 2005, 16:22
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Well actually, I am new with mc access and I dont know much about designing database queries that involves calculation.

But with excel, I know a little bit.
So...am I seeing a light at the end of the turnel
Can my problem be solved according to my idea that i've poster earlier?

What CSV by the way?
Thanx rob for replying my Question.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Apr 3rd, 2005, 19:28
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
An excel spreadsheet can be used as a database. Use this connections tring (from www.connectionstrings.com):

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""

notes:

"HDR=Yes;" indicates that the first row contains columnnames, not data
"IMEX=1;" tells the driver to always read "intermixed" data columns as text
TIP! SQL syntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Apr 5th, 2005, 14:43
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
OK...I found this code in the internet and I just couldnt find whats the problem with it.

This code accept 3 input from the user and then send the data to excel...
Could anybody help me?


Code: Select all
<html>
<title>CodeAve.com(Create Excel from User Input)</title>
<body bgcolor="#FFFFFF">
<%
'Check to see if title has been entered or not
u_title=request.form("u_title")
if u_title = "" then
%>

<form method="POST" action="<%= request.servervariables("script_name") %>">
Document Title

<input type="text" name="u_title" size="35">



Cell 1


<textarea rows="2" name="u_cell1" cols="35"></textarea>



Cell 2


<textarea rows="2" name="u_cell2" cols="35"></textarea>
<input type="submit" value="Submit" ></p>
</form>
</body>
</html>
<%
else

' If there is a user inputted title
' get all of the user inputed values
u_title=request.form("u_title")
u_cell1=request.form("u_cell1")
u_cell2=request.form("u_cell2")

' Varible created fo excel file name. Speces are changed to underscores
' and later the current date is added in attempts to create a unique file
' Users are not prevented from entering characters !@#$%^&*()+= that are 
' invlaid file names in this example
g_filename=replace(u_title," ","_")


set fso = createobject("scripting.filesystemobject")
'   create the text (xls) file to the server adding the -mmddyyyy after the g_title value
Set act = fso.CreateTextFile(server.mappath(""&g_filename & "-"& month(date())& day(date())& year(date()) &".xls"), true)

'   write all of the user input to the text (xls) document    
'   The .xls extension can just as easily be .asp or .inc whatever best suits your needs
'   Providing that you remove the info contained in the header and remove the xml
'   reference in the html tag that starts the page/excel file.  It is to add gridlines and
'   a title to the excel worksheet
act.WriteLine "<html xmlns:x=""urn:schemas-microsoft-com:office:excel"">"
act.WriteLine "<head>"
act.WriteLine "<!--[if gte mso 9]><xml>"
act.WriteLine "<x:ExcelWorkbook>"
act.WriteLine "<x:ExcelWorksheets>"
act.WriteLine "<x:ExcelWorksheet>"
act.WriteLine "<x:Name>"& u_title &"</x:Name>"
act.WriteLine "<x:WorksheetOptions>"
act.WriteLine "<x:Print>"
act.WriteLine "<x:ValidPrinterInfo/>"
act.WriteLine "</x:Print>"
act.WriteLine "</x:WorksheetOptions>"
act.WriteLine "</x:ExcelWorksheet>"
act.WriteLine "</x:ExcelWorksheets>"
act.WriteLine "</x:ExcelWorkbook>"
act.WriteLine "</xml>"
act.WriteLine "<![endif]--> "
act.WriteLine "</head>"
act.WriteLine "<body>"
act.WriteLine "<table>"
act.WriteLine "<tr>"
act.WriteLine "<td>"
act.WriteLine u_cell1
act.WriteLine "</td>"
act.WriteLine "<td>"
act.WriteLine u_cell2
act.WriteLine "</td>"
act.WriteLine "</tr>"
act.WriteLine "</table>"
act.WriteLine "</body>"
act.WriteLine "</html>"
' close the document 
act.close
%>
Your excel has been successfully create and can be viewed by clicking 
.xls" target="_blank">here
<%
end if
%></body></html>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Apr 5th, 2005, 17:40
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
looks like its missing the class 'act'
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Apr 5th, 2005, 22:03
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,158
Blog Entries: 7
Thanks: 27
Thanked 19 Times in 16 Posts
you are right.... that code is no class act.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Apr 6th, 2005, 02:42
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
What should I do with that...?
I downloaded the code from http://www.codeave.com/asp/code.asp?u_log=148

I just dont know how to make the code works on my pc...
Could anybody guide me please...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
asp, excell

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:54.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42