Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reading data from CVS file
#1
Solved: 11 Years, 4 Months ago
Hi Guys,

Just wondering does anyone know how to read data in from a CVS file (comma seperated file). The file is in the format - "A","B","C", "D". I wish to read in those values as something like -
Var1 = "A"
Var2 = "B"
Var3 = "C"
Var4 = "D"

Any help on this would be great.

Cheers,
Brian
Reply
#2
Solved: 11 Years, 4 Months ago
Hi,

You can store the value in a string i.e.,
Code:
Step 1:Set objExcel = CreateObject("Excel.Application")
Step 2:Set objWorkbook = objExcel.WorkBooks.Open("D:\TestData.xls")
Step 3:Set objDriverSheet = objWorkbook.Worksheets("Sheet1")
If Cell A1 stores the value = "A","B","C", "D"
Step 4: datataken = objDriverSheet.Cells(1, "A").value
Now  datataken will store "A","B","C", "D"
split this text with split function in vb as
Step 5: dataarray = split(datataken,",",-1)
Step 6:Var1= dataarray(0)
Step 7:Var1= dataarray(1)
Step 8:Var1= dataarray(2)
Step 9:Var1= dataarray(3)
That's it .. this code will definitely work
Reply
#3
Solved: 11 Years, 4 Months ago
Thanks Kamalteja,

thats a great help, i will try that code now.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading Global Sheet's DataTable Value Bhuvana 0 1,640 01-05-2020, 10:03 PM
Last Post: Bhuvana
  Reading Value from Java Table arjun.singh 8 24,411 10-11-2017, 02:51 PM
Last Post: sivaji
  dtLocalSheet empty even though excel file contains data cantorre 2 2,434 05-10-2017, 12:47 PM
Last Post: vidhi
  Reading data from excel sheet serenediva 1 9,621 03-03-2017, 10:07 AM
Last Post: vinod123
  Grab multiple line data from log file haziqwebs 0 1,801 10-19-2016, 01:28 PM
Last Post: haziqwebs

Forum Jump:


Users browsing this thread: 2 Guest(s)