Original post

CSV is a highly accepted data language, commonly used by Excel and spreadsheets, and as such is very useful if your script is producing data and you want it in a common format.
In the example, we’re forming a data variable, just to illustrate the example, by creating a multi-dimensional array of strings. We are then having to create a file (result.csv) for the csv writer to work with. Finally, we are iterating through the data writing each line to the file.