The problem was the file creation. I tried to create an xls file based on the 97-03 Excel version. This version does not allow for Excel files with many many lines. I simply changed the output file to .xlsx and it worked.