# How to save the vtkPoints to CSV file format?

**URL:** https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115
**Category:** Support
**Created:** [November 21, 2019, 2:15am UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115 "2019-11-21T02:15:50Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [November 21, 2019, 2:15am UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115/1 "2019-11-21T02:15:50Z")

</div>

Hi all 🙂

I have a question about vtkPoints to CSV file format.

My code is:  
vtkNew m\_vtkPLYReader;  
vtkNew m\_vtkPCDPoints;

```
m_vtkPLYReader->SetFileName(path.c_str()); // Load ply file
m_vtkPLYReader->Update();
m_vtkPCDPoints->DeepCopy(m_vtkPLYReader->GetOutput()->GetPoints());

//How to save vtkPoints to CSV?

```

But I don’t know how to save CSV file format.

I have tested with example code as below:  
[https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/ArrayToTable/](https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/ArrayToTable/)  
[https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/DelimitedTextWriter/](https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/DelimitedTextWriter/)

Please advise for me 😢

Thank you 🙂

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 24, 2019, 2:25pm UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115/2 "2019-11-24T14:25:39Z")

</div>

Hello, what did you get when you tried to run the examples?

---

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [November 27, 2019, 7:09am UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115/3 "2019-11-27T07:09:10Z")

</div>

Hi @Paulo_Carvalho  
I’m so sorry for my late reply.

I don’t understand your question.  
Could you please explain again in detail?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 27, 2019, 10:52am UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115/4 "2019-11-27T10:52:36Z")

</div>

You tried to run these examples below. Yes or no?

> [@Kim\_William](#):
>
> [https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/ArrayToTable/](https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/ArrayToTable/)  
> [https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/DelimitedTextWriter/](https://lorensen.github.io/VTKExamples/site/Cxx/InfoVis/DelimitedTextWriter/)

---

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [December 3, 2019, 12:22am UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115/5 "2019-12-03T00:22:49Z")

</div>

I already ran these examples and there were no problems.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 3, 2019, 1:34pm UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115/6 "2019-12-03T13:34:59Z")

</div>

Fine. So you simply need to change their code in order to conform to CSV format, which is quite straightforward, very similar to the second example.

Here’s an example of a CSV file (first line instructs MS Excel that the comma is the column separator):

```
sep=,
1997,Ford,E350,"ac, abs, moon",30100.00
1999,Chevy,"Venture ""Extended Edition""",,49000.00
1996,Jeep,Grand Cherokee,"MUST SELL!
air, moon roof, loaded",479699.00
```

---

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [December 4, 2019, 2:14am UTC](https://discourse.vtk.org/t/how-to-save-the-vtkpoints-to-csv-file-format/2115/7 "2019-12-04T02:14:23Z")

</div>

Ah… I’m sorry. I don’t understand your reply.

My purpose is to save the CSV file from the ‘vtkPoints’.

I have already tested as follow:

1. Loading CSV file by ‘vtkDelimitedTextReader’ and updating to ‘vtkRenderWindow’.
2. Loading PLY file by ‘vtkPLYReader’ and updating to ‘vtkRenderWindow’.
3. Loading PLY or CSV file and updating to ‘vtkPoints’, and saving PLY format file.

I can get the ‘vtkPoints’ from the ‘vtkPLYReader’ or ‘vtkDelimitedTextReader’.

But, I still don’t know how to save the CSV file from ‘vtkPoints’.
