Showing results for 
Search instead for 
Did you mean: 

Having problems reading an exported Magento CSV file

Having problems reading an exported Magento CSV file

Hi. I'm trying to programmatically read an exported Magento CSV file containing products information using Java (but the language I use is really irrelevant here, I just mention it in case anyone wonders).


I work for a company who uses Magento for their ecommerce site. I got this CSV file from the Magento admin screen by going to System >> Import/Export >> Export, and after specifying the products I needed, I got a CSV file.



A CSV file is typically rows of comma-delimited data where one row is one record. Clearly that is not the case with Magento's CSV file because there are some fields that can contain HTML text that could really expand the size of one record. Also, I noticed one product record in Magento consists of variable number of lines.


To make a long story short, I need help on technical specifications on how I can tell where a record ends. I know the starting record always begins with a SKU number, but how can I tell when that product ends, especially since there are huge fields of HTML data that can use CRLF or LF as line terminators. Apparently, Magento's import utilty can read it back in without a problem.,



Another example is field 8 (called Additional Info), which can also be a huge chunk of HTML data, and I'm not sure how Magento can tell when the field ends because the  HTML data can contain a lot of commas, totally throwing my program off.


Any help or advice on this matter would be greatly appreciated. Thanks.