I would help us greatly if you provided us with a Short, Self-Contained, Correct Example, concentrating on the essential problem, showing input and expected output and avoiding unnecessary code, like e.g. to parse Excel.
Thank you, ill work on getting more short and precise once I finish this other project, I actually figured out a work around with out connecting to the database. It works well since the typical data I'm dealing with is pretty small scale 10k-100k worth of lines.