Check to see if csv column exists?

Im making some automation scripts and id like to be able to check if a column exists in the csv.
For example there could be 6 columns but only 2 might be in use one one row and 4 might be in use on the next.
Can anyone help?

edit: i figured it out

if array[4] =! undefined do ( )