Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Find the row contents in CSV File

$
0
0

Hi Forum,

 

Im reading the CSV file, and want to find the content on a Cell, which is is below the content "retail" in a header row, and referring the indesign file name which is present at the last column, same row, of the content which is Im finding for.

 

     

Start DateEnd Datelook and feelMechanicMathingretailSavingAdditional MessagingRMS CODEPA CodeINDD NAME
17/09/201407/10/2014ValueWantedYes£1"Mr Muscle/Fairy"521381889543126810
17/09/201407/10/2014NormalWantedYes£1SST521381888443126811
17/09/201407/10/2014SecondWantedYes£1SST521381889043126812
17/09/201407/10/2014ThirdNot WantedNo£6SST531981893643126813
17/09/201407/10/2014FourthSingle orderNo£1SST536981896543126814
17/09/201407/10/2014FifthDouble orderNo£1SST536981896843126815

 

 

 

var myFile = File("/Users/studio/Desktop/Workbook.csv");

if (!myFile){ 

exit(); 

}      

 

 

myFile.open('r'); 

while (myFile.eof==false){ 

myFind=myFile.readln(); 

 

line2 =myFind.split(","); 

line3 = line2;

 

myFile.close();

}

 

 

 

 

myFile.open('r'); 

while (myFile.eof==false){ 

     myFile.readln(); 

          line1=myFile.read(); 

 

 

line1 = line1.split(/['\,\r\n']+/);

 

    NewmyFind = line1;

 

}

 

 

for(i=0; i<line3.length; i++) {

    myFind4 = line3[i]; 

 

    for(k=0; k<NewmyFind.length; k++) {

if(NewmyFind[k]=="43126812"){

if(myFind4 == "retail" && NewmyFind[myFind4.length-1])

{

      

var temp = i;

lineFinal = [];

 

 

lineFinal.push(NewmyFind[k][temp]);

alert (lineFinal);

}}}}

myFile.close();

 

 

 

Can anybody help on this please.

thanks


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>