@ranbarr: About your code: although there is room for improvement your code should work. The problem is in the data.
About saving your data as CSV: I don't have Excel so I cannot check, but when saving your data as CSV, is there an option to choose a separator? It seems a space is chosen as separator.
If there is no option to choose a separator, please read How to change the delimiter when exporting CSV from Excel.
About saving your data as CSV: I don't have Excel so I cannot check, but when saving your data as CSV, is there an option to choose a separator? It seems a space is chosen as separator.
If there is no option to choose a separator, please read How to change the delimiter when exporting CSV from Excel.