Solved

parse data from csv file to webpage

Posted on 2014-03-12
3
498 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 53

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 53

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 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