Forum Discussion

anik_cadieux's avatar
anik_cadieux
Contributor
12 years ago

How to get first line of data from CSV file that does not contain header


Hi,


 


We use the following code to get values from a CSV file:


 


DDT.CSVDriver(strFile);


do 




  lstFilesInCSV = DDT.CurrentDriver.Value(IntColNoFilename)


  DDT.CurrentDriver.Next();


  i++;


}


while (!DDT.CurrentDriver.EOF())


 


Unfortunately, we don't have control over the incoming CSV file, and it doesn't contain headers. So the first line of data is missing from the resulting vairable lstFilesInCSV.


 


Also, the filename and worksheet is know at execution time, so we can't use project variable of DB Table type.


 


Do you know any way of getting all the values of the CSV file, INCLUDING the first line ?


 


Thank you


Anik

  • karkadil's avatar
    karkadil
    Valued Contributor
    Fortunately, you can control how to process CSV file from your scripts :)

    http://support.smartbear.com/viewarticle/29570/



    Read about schema.ini file there. All you need to do is to place a corresponding file to the same folder where your CSV is located and then you will be able to read the data even without header line.