You will be better able to diagnose the csv conversion error if you park the incoming csv text in a global variable before attempting csv conversion.
Show the bad csv text.
You might have leftover files with a trailing comma, which would break CSV table conversion.