You can use the block to append csv rows to the string and when the block exits the final string will be returned. How to write utf 8 in a csv file. This is what a csv file looks like.