# Convert a csv file into ROOT format

**URL:** <https://root-forum.cern.ch/t/convert-a-csv-file-into-root-format/33217>\
**Category:** Newbie\
**Created:** [March 18, 2019, 7:14pm UTC](https://root-forum.cern.ch/t/convert-a-csv-file-into-root-format/33217 "2019-03-18T19:14:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [March 18, 2019, 8:59pm UTC](https://root-forum.cern.ch/t/convert-a-csv-file-into-root-format/33217/2 "2019-03-18T20:59:49Z")

</div>

Hi,

you can use [RDataFrame](https://root.cern/doc/master/classROOT_1_1RDataFrame.html) and [CSV data source](https://root.cern/doc/master/classROOT_1_1RDF_1_1RCsvDS.html).  
[This](https://root.cern/doc/master/df014__CSVDataSource_8C_source.html) is a more complete example.  
Basically, you’ll have to perform the following steps:

```auto
auto fileName = "myFile.csv";
auto rdf = ROOT::RDF::MakeCsvDataFrame(fileName);
rdf.Snapshot("myTree", "myFile.root");

```

Cheers,  
D

---

_[View the full topic](https://root-forum.cern.ch/t/convert-a-csv-file-into-root-format/33217)._
