Question
Reading, Modifying, Writing CSV files
Hi,
I'll be reading .csv files. A small file could be 20 columns and around 1000 rows. A medium sized file would be 20 columns and around 5000 rows. Basically I need to read the column headings, and possibly change the value. Then on a row by row basis, I need to examine the value, and make sure it meets specific criteria. Once the row field has been manipulated, I need to write it back to the file. Ultimately, I'm going to upload the file to a database.
I'm seeing and reading about lots of different tags and possible ways to do this. <cfhttp> <cffile read/write>. I'd appreciate any thoughts on how to do this effectively. I'm using CF8.
Here is some sample data:
UPC, Brand, Prod_Description
55555-10111, Kraft, Kraft Mac&Cheese 6oz
55555-10117, Kraft, Kraft Spirals with Cheese 7oz
I'd like to change Prod_Description to Description
I'd like to remove the hypens in the upc numbers to that they look like 5555510111.
Any thoughts on a "stable" approach would be appreciated. If the size of the file went up to 50,000 rows, would this still work? If not, is there a different approach that could handle it?
Thanks!!
cfwild
I'll be reading .csv files. A small file could be 20 columns and around 1000 rows. A medium sized file would be 20 columns and around 5000 rows. Basically I need to read the column headings, and possibly change the value. Then on a row by row basis, I need to examine the value, and make sure it meets specific criteria. Once the row field has been manipulated, I need to write it back to the file. Ultimately, I'm going to upload the file to a database.
I'm seeing and reading about lots of different tags and possible ways to do this. <cfhttp> <cffile read/write>. I'd appreciate any thoughts on how to do this effectively. I'm using CF8.
Here is some sample data:
UPC, Brand, Prod_Description
55555-10111, Kraft, Kraft Mac&Cheese 6oz
55555-10117, Kraft, Kraft Spirals with Cheese 7oz
I'd like to change Prod_Description to Description
I'd like to remove the hypens in the upc numbers to that they look like 5555510111.
Any thoughts on a "stable" approach would be appreciated. If the size of the file went up to 50,000 rows, would this still work? If not, is there a different approach that could handle it?
Thanks!!
cfwild