[Tutor] reading Excel CSVs?

Lance E Sloan lsloan at umich.edu
Thu May 27 11:24:30 EDT 2004

--On Friday, May 14, 2004 10:21 AM +0200 Magnus Lyckå <magnus at thinkware.se> 
> I think csv [the module] is confused by the fact that there is no
> line feed character in line endings on the Mac.
> Unix uses \n, WinDOS uses \r\n and Mac uses \r.
> I'd try opening the files with file("true-csv.csv", "rU")
> Note capital U. This is the universal line ending mode. See
> file function in Library reference section 2.1.

Thank you very much.  That did the trick.

I've not dealt with non-Unix files much.  I'm using Mac OS X, which uses 
Unix line endings for the most part.  So this file produced by Excel for 
MOSX is a bit of an oddity.  Maybe the programmers at MS didn't realize the 
CSV-producing part might need to be changed for MOSX.  Or maybe there's a 
line-ending option in Excel.

Anyway, using "U" mode, I don't need to worry about it, right?  ;)

Lance E Sloan, Systems Research Programmer III
U-M WATS: Web Applications, Technologies, and Solutions
Full-service web and database design, development, and hosting.
http://www.itcs.umich.edu/wats/ - "Putting U on the Web"

More information about the Tutor mailing list