Text qualifiers are used to let a program know that anything between a certain character should be interpreted as it is (Normally text). If you don’t get what ‘adding double quote text qualifier in a csv file’ means; In simple terms this will change a line like this: email,fname,lname,ipaddress to: “email”,”fname”,”lname”,”ipaddress”. Very simple.
I recently found out that I could not add double quotes to his CSV file that contained data I needed to upload. I looked around and the only actual thing I could find was a command prompt style replacer, which doesn’t suite a clients need for simplicity. Programs like Microsoft Excel seem to not want to add double quote text qualifiers in your CSV files, and in some cases will remove the automatically. The download links will be below.
I quickly created my own little VB.NET program to handle adding double quote text qualifiers that is user friendly. It will add double quotes to the beginning, end, and between each delimiter you specify. Currently, there are only a set group of delimiters to pick from, and I didn’t want to get fancy (Custom delimiter) to confuse the customer. This program will in no way ever overwrite a existing file as well so it should be safe to handle with. If you specify the file “Test.csv”, the output file will be “Test-1.csv”, or “Test-2.csv”, etc, depending on what ‘number’ is a free file. It will also handle VERY LARGE FILES because it processes per line rather then the traditional/stupid way of saving everything to an array. This means it is also very fast! I did not add a process bar however as I didn’t want to bother counting the lines before processing a file. More time wasted. Instead, it uses a simple label to display the status of where it is at.
I will provide the source so you can modify the program at will and make it even more fancier. This is very basic and I whipped it up in under 20 minutes. It should contain basic comments so you know what everything does. Hopefully this helps someone!
- DirectX: Trouble with double values not returning a proper precision value after initializing DirectX?
- PHP: Randomizing a text file using PHP + MYSQL, quickly & efficient
- PHP: Easy to use logging class for your scripts.
- Modified: Solmetra Flash Uploader v1.02 (to multi-file uploader) & A quick way to pass variables.