I can see the issue is related to this: Using a Variable in a Range
Edited to add: The reason it fails is because you are iterating over $range
, which is a string, and not the data file that you want to iterate over.
But still trying to find the right method/syntax…