vikassardesai
6 years agoOccasional Contributor
Is there any way to retrieve csv row numbers
I have suppose 15 records in csv. and with each record I want to update some value say if there is first row then the value should be "Val_1". For second record, it should be "Val_2" and so on.
So, for example, in "Val_4" value, the part "Val_" is to be remained contant only the number part will be updated by the CSV record row number.
Is this possible?
Thanks,
Vikas.
The CSV records don't have native Row numbers. What I would do is, since I'm assuming you're using something like DDT.CSVDriver to drive reading your file, is to just put a counter in your while loop to increment each time through, tracking the numbers. Then utilize that counter to append your values.