C
cartercc
I create and deliver CSV files like this:
"12345","John","Q","Public","123 Main Street","Anywhere,
Alaska","800-555-1212"
I create this in my program as a seven element array. Users modify the
files, frequently using Excel, and return the files to me.
Sometimes I get the original format back.
Sometimes, Excel will mangle the file to this:
12345,John,Q,Public,123 Main Street,"Anywhere, Alaska",800-555-1212
My script will read this as an eight element array (splitting
"Anywhere, Alaska" on the comma).
Sometimes Excel will produce a tab delimited file like this:
12345 John Q Public 123 Main Street "Anywhere, Alaska" 800-555-1212
My script will read this as a two element array.
My users like to use Excel and I am not inclined to tell them they
can't, nor am I inclined to 'educate' them on making sure that Excel
doesn't change the file format. They honestly need the filtering and
sorting capabilities that Excel provides, as some of these files are
106 columns wide and thousands of rows deep. I have error checking in
place that rejects improperly formed files, which I define as
producing anything other than an X element array. However, this isn't
satisfactory, because I have the burden of reformatting the file.
Comments? Suggestions? Any module that automagically reformats files?
Will I have to write a reformatting script myself?
Thanks, CC.
"12345","John","Q","Public","123 Main Street","Anywhere,
Alaska","800-555-1212"
I create this in my program as a seven element array. Users modify the
files, frequently using Excel, and return the files to me.
Sometimes I get the original format back.
Sometimes, Excel will mangle the file to this:
12345,John,Q,Public,123 Main Street,"Anywhere, Alaska",800-555-1212
My script will read this as an eight element array (splitting
"Anywhere, Alaska" on the comma).
Sometimes Excel will produce a tab delimited file like this:
12345 John Q Public 123 Main Street "Anywhere, Alaska" 800-555-1212
My script will read this as a two element array.
My users like to use Excel and I am not inclined to tell them they
can't, nor am I inclined to 'educate' them on making sure that Excel
doesn't change the file format. They honestly need the filtering and
sorting capabilities that Excel provides, as some of these files are
106 columns wide and thousands of rows deep. I have error checking in
place that rejects improperly formed files, which I define as
producing anything other than an X element array. However, this isn't
satisfactory, because I have the burden of reformatting the file.
Comments? Suggestions? Any module that automagically reformats files?
Will I have to write a reformatting script myself?
Thanks, CC.