ECI: Bad File Examples
I should have created this post a long time ago. The number one problem with any data importer is what the importer is being fed or told to do. This post will detail do’s and don’ts for your CSV file. I will update it has things come to me.
myproductfile.csv.txt
Can you see anything wrong with this file name? I can’t, it is a perfectly valid file name and is an example of files people try to use. It is a valid file name providing the application accepts it. Easy CSV Importer does not work with .txt at this time and this is a .txt file. Also I never coded the plugin to take .csv.txt into consideration and even right now I don’t have a clue how ECI would react to a file with “.csv.csv”. I’m not going to test it either. These are the sort of things that happen but are so rare we don’t go spending a lot of time getting around them. I’ve never yet seen a file downloaded from a website that provides the file with an extension like this and that is generally what I go by.
Column Headers/Titles/Names
The first CSV importers for WordPress and in general most of the scripts for PHP required specific header names to be used. This actually a lot better for performance but generally not a good approach for a plugin that is meant to be used by hundreds who all have various different CSV files. So we sacrifice performance for flexibility by allowing any CSV file file with any column titles to be used. Whatever you called them, your CSV file’s header row/row one/ first row requires labels for each column. They can be anything you like. If you plan to update your CSV file by overwriting it with newer files then the format of the file must not change, only the number of rows the file contains can change in order for updating to work. This is because one Easy CSV Importer establishes the format of your CSV file i.e stores your column names. Then it not only expects those same column names but it expects them in the same order. This is the best way to maximize performance and something I’m trying to perfect.