# Add Column on csv file

**URL:** <https://discourse.processing.org/t/add-column-on-csv-file/33572>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [November 17, 2021, 9:18am UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572 "2021-11-17T09:18:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anwar05](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@anwar05](https://discourse.processing.org/u/anwar05)\
**Post date:** [November 17, 2021, 9:18am UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572/1 "2021-11-17T09:18:10Z")

</div>

I want to save data in tabular form and want to save it in excel (csv) form, I have checked references and also tried examples from the internet, there are no errors, but when I addColumn (title) no new column is formed besides the previous column.

here’s an example that I run, and the result

```auto
Table table;

void setup() {

  table = new Table();
  
  table.addColumn("id");
  table.addColumn("species");
  table.addColumn("name");
  
  TableRow newRow = table.addRow();
  newRow.setInt("id", table.getRowCount() - 1);
  newRow.setString("species", "Panthera leo");
  newRow.setString("name", "Lion");
  
  saveTable(table, "data/new.csv");
}

// Sketch saves the following to a file called "new.csv":
// id,species,name
// 0,Panthera leo,Lion

```

![nanya before](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/3ece827eb869a5208760b594bbf5597f9a04794d.png)

but i want it like this, is it possible? Any suggestions for me? thank you  
 ![pengen gini](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ef67b7f1b8314b7f0c11407171c843205dc8088f.png)

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 17, 2021, 10:19am UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572/2 "2021-11-17T10:19:44Z")

</div>

The problem here is Excel  
You can’t use “open” here  
Instead use “import data…” or something

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 17, 2021, 11:15am UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572/3 "2021-11-17T11:15:22Z")

</div>

Hello,

It works here with a couple of different versions of Excel:

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/786b229a4064acd46db619c0f71dcddae12b5787.png)

Are you seeing an excel icon?

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/bd72b800155fc2837ac9a28230cb90ce0fd2311f.png)

I may be related to regional settings:  
[https://support.affinity.co/hc/en-us/articles/360044453711-How-to-open-CSV-files-with-the-correct-delimiter-separator](https://support.affinity.co/hc/en-us/articles/360044453711-How-to-open-CSV-files-with-the-correct-delimiter-separator)

It just did a quick search…

`:)`

---

<div class="post-metadata">

**Author:** ![anwar05](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@anwar05](https://discourse.processing.org/u/anwar05)\
**Post date:** [November 17, 2021, 1:01pm UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572/4 "2021-11-17T13:01:24Z")

</div>

Hello @glv , thank you for replying. The data icon that I saved looks like this  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/da7462d669327d29a9ecd9dc9369dbfb691bf685.png)

what do you mean regional setting??, setting on excel??, hmm i’ll read that link. Thank you…

---

<div class="post-metadata">

**Author:** ![anwar05](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@anwar05](https://discourse.processing.org/u/anwar05)\
**Post date:** [November 17, 2021, 1:03pm UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572/5 "2021-11-17T13:03:43Z")

</div>

problem is excel? @Chrisir, actually i don’t want to import data but i want to save data.  
Thank you @Chrisir for replying …

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 17, 2021, 1:58pm UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572/6 "2021-11-17T13:58:38Z")

</div>

As I wrote: imho the text file is correct so it’s not a Problem how you write the data

Instead it’s a Problem of how you load the data in Excel; please import it

---

<div class="post-metadata">

**Author:** ![anwar05](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@anwar05](https://discourse.processing.org/u/anwar05)\
**Post date:** [November 17, 2021, 2:19pm UTC](https://discourse.processing.org/t/add-column-on-csv-file/33572/7 "2021-11-17T14:19:41Z")

</div>

halo @Chrisir and @glv , both of u are right. I’ve tried with link above that is share by @glv.  
Now it’s clear thank you so much
