Solved

parse data from csv file to webpage

Posted on 2014-03-12
3
490 Views
Last Modified: 2014-03-12
I have a csv file that has 7 columns and 1974 rows. this csv file is automatically put in the folder every 5 minutes and the old one is just overwritten. I have no way of making this a template file so what i need to do is get this data into something that will allow me to pull data out of it and post to a webpage metric table. column A is the column that had the "name" i would be looking for to decide what data I am wanting to post. The webpage would be an ASP page and I am familier with using vbscripting code and pulling data that way. I have attached a sample of how the CSV file is formatted.
testWeb.csv
0
Comment
Question by:jlcannon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
ID: 39923753
Try this

<%
Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\inetpub\wwwroot\folder\testWeb.csv", ForReading)
response.write "<table>"
Do Until objFile.AtEndOfStream
    strLine = objFile.ReadLine
    arrFields = Split(strLine, ",")
    
	response.write "<tr><td>"&arrFields(0)& "</td><td>"&arrFields(1)&"</td><td>"&arrFields(2)&"</td><td>"&arrFields(3)&"</td></tr>"
 
Loop

objFile.Close
%>

Open in new window

0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39923758
If you need to filter the first column of what I posted, you could do

<%
Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\inetpub\wwwroot\folder\testWeb.csv", ForReading)
response.write "<table>"
Do Until objFile.AtEndOfStream
    strLine = objFile.ReadLine
    arrFields = Split(strLine, ",")
    
    if arrFields(0)="Greek" then
	response.write "<tr><td>"&arrFields(0)& "</td><td>"&arrFields(1)&"</td><td>"&arrFields(2)&"</td><td>"&arrFields(3)&"</td></tr>"
 end if
Loop

objFile.Close
%>

Open in new window

0
 

Author Closing Comment

by:jlcannon
ID: 39923878
Thank you this will help get me on my way. Still have hurdles with this data but this is exactly the start I needed.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question