Format all input data before writing into csv