Question Locked

How to save HTml form user input in Excel Sheet . ?(Web page NOT online.)

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

HI ,

YOu will see a HTml code below ..Copy and paste this code in a Notepad or Textedit then save it as .html extension. Preview IT in your browser you should be able to see this form.

Once you enter the values in the form and hit the "submit" button ..This acion should save the values in the Excel sheet ...BUT it does not please advice if what do i need to change or advise a lkink or give me a example how it could be done

I APPRECIATE ANY HELP OR ASSISTANCE !

***************************

<%
'Check to see if title has been entered or not
u_title=request.form("u_title")
if u_title = "" then
%>

<%
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 ""
act.WriteLine ""
act.WriteLine " "
act.WriteLine ""
act.WriteLine ""
act.WriteLine "

"
act.WriteLine "

"
act.WriteLine "

"
act.WriteLine "

"
act.WriteLine "

"
act.WriteLine "

"
act.WriteLine u_cell1
act.WriteLine "
"
act.WriteLine u_cell2
act.WriteLine "

"
act.WriteLine ""
act.WriteLine ""
' close the document
act.close
%>
Your excel has been successfully create and can be viewed by clicking
here

<%
' end check of form input
end if
%>

***************************

2 replies

This discussion is closed to new replies.