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
Solved

parse data from csv file to webpage

Posted on 2014-03-12
3
488 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Obtain data from database .mdb 4 19
I'm trying to understand this simple vb code! 2 17
ASP exit 10 18
Having trouble with a VB Script 17 16
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

790 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