In principle you are doing the right thing. Two things though:
- Is vDirPath defined?
- The 'From $(csvfile)' should be quoted: From [$(csvfile)]
Further, I agree with Paul that you should use the debugger to find the error. Press "Step" until you come to the relevant statements, and check that the For-Next and the Load have correct parameters.
I have actually been trying the same thing a couple of hours and by combining the mentioned solution in this post with a solution from another i came up with a nice solution. You can probably just copy/paste if you want to try it. My solution fetches all the xml files in a folder so you can just change "*.xml" to your preferred file ending.
FOR Each File in filelist ('$(vPath)*.xml')
(XmlSimple, Table is [Database/Data]);