# Saving using DelimitedFiled with header

**URL:** https://discourse.julialang.org/t/saving-using-delimitedfiled-with-header/38793
**Category:** New to Julia
**Tags:** question
**Created:** [May 5, 2020, 8:25am UTC](https://discourse.julialang.org/t/saving-using-delimitedfiled-with-header/38793 "2020-05-05T08:25:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)
#### Post date: [May 5, 2020, 8:25am UTC](https://discourse.julialang.org/t/saving-using-delimitedfiled-with-header/38793/1 "2020-05-05T08:25:26Z")

</div>

On [StockOverflow](https://stackoverflow.com/questions/49684253/how-to-write-outputs-with-header-by-using-writecsv-writedlm-in-julia), I noticed a simple example of saving data to a delimited file:

```
x = [1 2 ; 3 4]
header = ["a" "b"]
writedlm(somefilepath, ',', [header ; x])

```

However, when I implement the code, all I get is a file with a comma. Has there been changes to Julia since the answer was posted (April 6., 2018), which renders the answer inappropriate?

---

<div class="post-metadata">

### Author: ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)
#### Post date: [May 5, 2020, 8:45am UTC](https://discourse.julialang.org/t/saving-using-delimitedfiled-with-header/38793/2 "2020-05-05T08:45:05Z")

</div>

I would generally recommend using [CSV.jl](https://juliadata.github.io/CSV.jl/stable/) for writing and reading CSV data, since that has a lot more features and performance optimizations than DelimitedFiles. The latter works fine, if you just want to quickly write or read some data, but for anything more advanced, CSV.jl is definitely the way to go

---

<div class="post-metadata">

### Author: ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)
#### Post date: [May 5, 2020, 8:45am UTC](https://discourse.julialang.org/t/saving-using-delimitedfiled-with-header/38793/3 "2020-05-05T08:45:43Z")

</div>

The documentation says that writedlm should look like this:  
`writedlm(f, A, delim='\t'; opts)`

So if you use `writedlm(somefilepath, [header ; x], ",") ` it should work.

This solution is also present in the stack overflow page.
