Excel to ASP...

This is a discussion on "Excel to ASP..." within the Classic ASP section. This forum, and the thread "Excel to ASP... 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 Sep 24th, 2004, 14:48
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
Excel to ASP...

Hey Guys. You know who you are :wink:. I am going to be designing a grade book for a school system. I now have the knowledge to do everything but the one thing I need help on is the spreadsheet. I want it where when the spreadsheet is saved it will automatically upload it to the internet. I know I'd need some kind of software to do this with but once I get it on the internet can I use a spreadsheet just like i would use a database? The problem as you may know is security, but I am talking to my host about setting up a local Secure folder where no one can download anything in that folder. Plz let me know if you have found any good tutorials, have one yourself, or if you know any programs (free - $2000) that will do this. Much appreciation.

Wade
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Sep 24th, 2004, 17:21
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
I don't know the exact details but it seems to me that you'd be better off having your data source online and allowing your users to download the resulting spreadsheet.

I've done sumthing similar so I may be able to help with the solution if you explain what the problem is a bit better.

all I can do to help at the moment is point you here:
how to use a spreadsheet as datasource,just like a database:
http://webforumz.com/showthread.php?threadid=1400
(good article by the way!)
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Sep 24th, 2004, 17:28
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
well the reason I need it to go from the pc to the net is because I have a built-in-checker where if your not logged onto the school's network then you can't log-in to the system. It's extra security. Only LAN can make changes. I don't want some kid to hack the network and change everyone's grades you know.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Sep 25th, 2004, 07:58
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
I see.......
in that case I don't see how you can automatically save the spreadsheet to a webserver without using some sort of special program.......

OR
will all users be connecting to the internet from a fixed IP?
you could use that (as well as username/password) for your security
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Sep 25th, 2004, 18:32
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
I actally have the server on the same LAN as the pc's. So You won't be able to even access the updating stuff without being on the LAN. That part I can do. Maybe I'll just let them use access or something to get the files up.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Sep 26th, 2004, 08:25
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
well then, if its all on the same network then it's easier......
you can design your pages to connect to the spreadsheet just like you would with any ohter datasource.
the hard work will be to collect the data from the users and transfer it to the server.....

how much do you know about VBA?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Sep 26th, 2004, 13:08
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Court Jester...

Why dont you just write out a comma seperated volume(CSV) file, using the file system object.

Any CSV can be opened in Excel quite easily.

If you need help on CSV formatting, let me know.
__________________
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 Sep 26th, 2004, 16:05
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
last website I designed I had to use FSO to write out CSV files with financial summary and other information..... so I could hep on that too.......
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old Sep 27th, 2004, 08:35
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Out of interest, how are you only allowing LAN users access to the area which allows updating of the grades?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
Old Sep 27th, 2004, 12:19
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
i suppose, if the program/webpage used to access the spreadsheet/datasource is only available in the Local Network then you can just leave the security job to windows

right?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #11  
Old Sep 27th, 2004, 14:46
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
We have some program. I don't know what it's called... but it allows FTP access for LAN only. If you even try to FTP outside of the LAN then it kicks you off. Pretty neat. Also, if you log-in to the protected pages the program will boot you if your not on the LAN as well. I don't know how it works, I think it checks to see if your machine has the program running, and if so it checks some key information in the program, and if your program isn't running it'll kick you. The school system is leaving the county and going to their own school system so the county installed all the stuff on thier computers. Now they need someone else to do it since the county is no longer helping them.


I'm thinking about just building an ASP application (Intranet) and letting them do all the modifications that way. Then linking the databases off of that to show the kids thier grades. I don't know how to use the FSO or CSV.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #12  
Old Sep 27th, 2004, 17:56
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
I should really put this in the tutorials and code samples section but use this FSO module.
let's you write, delete, move, rename, copy files and folders easily......

Code: Select all
<%
' File System Object Module
' v1.2, May 2004
' diego@pinesandneedles.com
%>
<%
Function FixPath(Path)
  On Error Resume Next
  Path = "/" & Path & "/"
  Path = Replace(Path, "//", "/")
  Path = Replace(Path, "\/", "/")
  Path = Replace(Path, "/\", "/")
  Path = Replace(Path, "\\", "\")
  FixPath = Path
End Function



' GET FILE AND FOLDER OBJECTS
Function GetFolder(obj, FolderName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  Set obj = tmp_objFSO.GetFolder(Server.MapPath(FolderName))
  Kill tmp_objFSO
  GetFolder = CBool(Not (Err.number>0))
End Function

Function GetFile(obj, FileName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  Set obj = tmp_objFSO.GetFile(Server.MapPath(FileName))
  Kill tmp_objFSO
  GetFile = CBool(Not (Err.number>0))
End Function

Function GetParentFolder(FolderName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  GetParentFolder = tmp_objFSO.GetParentFolderName(FolderName)
  Kill tmp_objFSO
End Function

Function GetFiles(objRS, objFolder)
  Set objRS = Server.CreateObject("ADODB.Recordset")
  objRS.Fields.Append "name", adVarChar, 100
  objRS.Fields.Append "size", adInteger
  objRS.Fields.Append "size_caption", adVarChar, 50
  objRS.Fields.Append "date", adDate
  objRS.Fields.Append "modified", adDate
  objRS.Fields.Append "type", adVarChar, 255
  objRS.Open

  For Each objItem In objFolder.Files
   objRS.AddNew
    objRS.Fields("name") = objItem.Name
    objRS.Fields("size") = objItem.Size
    If objItem.Size<1024 Then
      objRS.Fields("size_caption") = objItem.Size & " bytes"
    Else
      objRS.Fields("size_caption") = FormatNumber(objItem.Size/1024,1)
    End If
    objRS.Fields("date")= objItem.DateCreated
    objRS.Fields("modified")= objItem.DateLastModified
    objRS.Fields("type")= objItem.Type
  Next ' objItem
End Function



' EXISTS ?
Function FileExists(FileName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  FileExists = tmp_objFSO.FileExists(Server.MapPath(FileName))
  Kill tmp_objFSO
End Function

Function FolderExists(FolderName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  FolderExists = tmp_objFSO.FolderExists(Server.MapPath(FolderName))
  Kill tmp_objFSO
End Function



' CREATE
Function CreateFolder(FolderName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  tmp_objFSO.CreateFolder(Server.MapPath(FolderName))
  Kill tmp_objFSO
  CreateFolder = CBool(Not (Err.number>0))
End Function
Function BuildPath(FolderName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  Folders = Split(FolderName,"/")
  Path = "/"
  For Each Folder In Folders
    If Trim(Folder)<>Empty Then
      Path = Path & Trim(Folder) & "/"
      If Not tmp_objFSO.FolderExists(Server.MapPath(Path)) Then tmp_objFSO.CreateFolder Server.MapPath(Path)
    End If
  Next  ' Folder
  Kill tmp_objFSO
  BuildPath = CBool(Not (Err.number>0))
End Function

Function NewFile(obj, FileName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  Set obj = tmp_objFSO.CreateTextFile(Server.MapPath(FileName), True)
  Kill tmp_objFSO
  NewFile = CBool(Not (Err.number>0))
End Function
Function CreateFile(FileName)
  NewFile tmp_file, FileName
  Kill tmp_file
  CreateFile = CBool(Not (Err.number>0))
End Function



' WRITE
Function OpenFile(objFile, FileName)
  On Error Resume Next
  GetFile F, FileName
  Set objFile = F.OpenAsTextStream(2,-2)
  Kill F
  OpenFile = CBool(Not (Err.number>0))
End Function

Function OpenTextFile(objFile, FileName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  Set objFile = tmp_objFSO.OpenTextFile(Server.MapPath(FileName))
  Kill tmp_objFSO
  OpenTextFile = CBool(Not (Err.number>0))
End Function

Function WriteToFile(FileName, FileContent)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  If tmp_objFSO.FileExists(Server.MapPath(FileName)) Then
    OpenFile tmp_objFile, FileName
  Else
    NewFile tmp_objFile, FileName
  End If
  tmp_objFile.Write(FileContent)
  Kill tmp_objFile
  WriteToFile = CBool(Not (Err.number>0))
End Function



' MOVING
Function MoveFolder(FolderName, Destination)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  tmp_objFSO.MoveFolder Server.MapPath(FolderName), Server.MapPath(Destination) & "\"
  Kill tmp_objFSO
  MoveFolder = CBool(Not (Err.number>0))
End Function

Function MoveFile(FileName, Destination)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  tmp_objFSO.MoveFile Server.MapPath(FileName), Server.MapPath(Destination) & "\"
  Kill tmp_objFSO
  MoveFile = CBool(Not (Err.number>0))
End Function



' COPYING and RENAMING
Function DoCopyFile(Source, Destination, NewName, DeleteSource)
  On Error Resume Next
  If GetFile(F, Source) Then
    F.Copy Server.MapPath(Destination) & "\" & NewName
  End If
  Kill F
  If DeleteSource And (Not (Err.number>0)) Then DeleteFile Source
  DoCopyFile = CBool(Not (Err.number>0))
End Function

Function CopyFileRename(Source, Destination, NewName)
  CopyFileRename = DoCopyFile(Source, Destination, NewName, False)
End Function
Function CopyFile(Source, Destination)
  CopyFile = DoCopyFile(Source, Destination, Empty, False)
End Function
Function RenameFileLeaveSource(Source, NewName)
  Location = Left(Source,InStrRev(Source,"/"))
  RenameFileLeaveSource = DoCopyFile(Source, Location, NewName, False)
End Function
Function RenameFile(Source, NewName)
  Location = Left(Source,InStrRev(Source,"/"))
  If Source<>(Location & NewName) Then ' different name
    RenameFile = DoCopyFile(Source, Location, NewName, True)
  End If
End Function

Function CopyFolderContents(Source, Destination)
  'On Error Resume Next
  GetFolder Folder, Source
  For Each File In Folder.Files
    Errors = Errors And CopyFile(Source & File.Name, Destination)
  Next
  Kill Folder
  CopyFolderContents = CBool((Not (Err.number>0)) And (Not Errors))
End Function


Function DoCopyFolder(Source, Destination, NewName, DeleteSource)
  'On Error Resume Next
  GetFolder F, Source
  F.Copy Server.MapPath(Destination) & "\" & NewName
  Kill F
  If DeleteSource And (Not (Err.number>0)) Then DeleteFolder Source
  DoCopyFolder = CBool(Not (Err.number>0))
End Function

Function CopyFolderRename(Source, Destination, NewName)
  CopyFolderRename = DoCopyFolder(Source, Destination, NewName, False)
End Function
Function CopyFolder(Source, Destination)
  CopyFolder = DoCopyFolder(Source, Destination, Empty, False)
End Function
Function RenameFolderLeaveSource(Source, NewName)
  Location = Left(Source,InStrRev(Source,"/"))
  RenameFolderLeaveSource = DoCopyFolder(Source, Location, NewName, False)
End Function
Function RenameFolder(Source, NewName)
  Location = Left(Source,InStrRev(Source,"/"))
  RenameFolder = DoCopyFolder(Source, Location, NewName, True)
End Function



' DELETE
Function DeleteFolder(FolderName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  tmp_objFSO.DeleteFolder(Server.MapPath(FolderName))
  Kill tmp_objFSO
  DeleteFolder = CBool(Not (Err.number>0))
End Function

Function DeleteFile(FileName)
  On Error Resume Next
  Set tmp_objFSO = FSO()
  tmp_objFSO.DeleteFile(Server.MapPath(FileName))
  Kill tmp_objFSO
  DeleteFile = CBool(Not (Err.number>0))
End Function
%>
then all you do is define you CSV string and write it to a file

e.g:
Code: Select all
MyCSV = "student id,name,score,grade" & vbCRLf

For Each Student In Request("Student")
 MyName = Request("Name" & Student)
 MyScore = Request("Score" & Student)
 MyGrade = Request("Grade" & Student)
 MyCSV = MyCSV & Student & "," & MyName & "," & MyScore & "," & MyGrade & vbCRLf
Next ' Student

WriteToFile "/test_folder/test.csv", MyCSV
I hope that helps you get started.......
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #13  
Old Sep 27th, 2004, 17:58
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
hey, I'VE GOT 3 STARS!!!!!!!!!!!!!!!!!!
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #14  
Old Sep 27th, 2004, 18:43
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Spinal.... consider turning this into an article matey!! That way you have an undirected (google friendly) backlink to your site.

For details, see this link:- http://www.webforumz.com/default.asp...9&CategoryID=1
__________________
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!
  #15  
Old Sep 27th, 2004, 20:44
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
wicked....
I've got a whole lotta stuff that I wuldn't mind sharing, but I won't give away my secret formulas!
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
excel, asp

« page error | id »
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone know much about Excel AdRock Webforumz Cafe 8 Sep 29th, 2007 19:58
Flash and Excel natepen Flash & Multimedia Forum 1 May 21st, 2007 15:56
Excel Thru Recovery Chase42304 Graphics and 3D 3 Nov 27th, 2006 14:21
Import Excel into PHP AndyP PHP Forum 9 Jul 20th, 2006 12:32
Excel problem madhuri.t Classic ASP 1 Mar 7th, 2006 01:23


All times are GMT. The time now is 23:27.


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