Create a .csv file like the following:
col1;col2 first;second third;fourth
The first row contains the header with column names, the others are data rows.
Call it source.csv and put it in any directory you want.
Now, in the same directory, create the example.script file containing:
# FROM CSV fileName: source.csv headers: true delimiter: ; # TO CSV fileName: dest.csv headers: true delimiter: , # COLUMN col1 => (1) name:dest1 COLUMN col2 => (0) name:dest2
The first section says you will read a CSV file called source.csv, that the first line of the file is a header conatining the column names and the column delimiter is a semicolon.
The second section says you will write on a CSV file called dest.csv, that you want to write a header with column names in it an the column delimiter will be a comma.
The third section contains column specifications. For each column you have:
With the first column definition you are saying that the data in the column called "col1" in the source file will be put in column number 1 (column numbers start at 0) whose name will be "dest1".
With the second you are saying that the data in the column called "col2" in the source file will be put in column number 0 whose name will be "dest2".
The rows starting with the # symbol are comments
So the net result of the script will be to:
Now open your command line window and enter the directory where you put the previous files, then type:
dataflush example.script
In the same directory you should get a dest.csv file containing:
dest2,dest1 second,first fourth,third
Experiment a bit with your script file, then go on with [Reading from a database]
Home: Home
Home: Install DataFlush
Home: Reading from a database