Copy link to clipboard
Copied
Hey!!
quick question.
I've extracted a cloumn from an excel sheet and i want to save this column in an array, how could i?
app.excelImportPreferences.properties = {
sheetIndex : 0,
aligmentStyle : AlignmentStyleOptions.SPREADSHEET,
rangeName :"B2:B114"
}
var myProperties = app.excelImportPreferences.properties;
myTextFrame.place(fileExcel, false, myProperties);
TBH, I've taken this code from the community and now I'm wondering how to save the range in array. Because if i manged to save it in array then i can loop through it, to manuplate it.
thanks all.
*I'm using javascript
Copy link to clipboard
Copied
if (column1contentsArray[i].row == column1contentsArray[i++].row
This will always alert true, since you're just comparing if a Row Object is equal to another Row Object. You need to drill down into the cells' contents to evaluate.
Copy link to clipboard
Copied
You need to drill down into the cells' contents to evaluate.
No. Because column1contentsArray[i] is already the contents of a cell.
But I wonder why there is a comparison with the contents where the iteration number is actually changed !
Our OP should do just a loop to see how the value of i will change in its course!
salshaw749, just run this little code in the ESTK ( ExtendScript Toolkit ), or if on Mac OS X where the ESTK cannot run anymore, test the script with an alert() instead of a $.writeln():
var counter = 0;
for(var i = 1; i < 10 ; i++)
{
$.writeln( counter.toString()+"\t"+ i );
$.writeln( counter.toString()+"\t"+ ( i === i++ ) ); // Always returns true
counter++
};
Result:
0 1
0 true
1 3
1 true
2 5
2 true
3 7
3 true
4 9
4 true
See, how the value of i is jumping? That makes no sense at all.
Also note, that [i] is always the same as [i++], because: first the values are compared and then the value of i is counted up.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
I've solve it by using nested loop! which is seems time consuming but more accurate!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more