Add Column on csv file

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

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

but i want it like this, is it possible? Any suggestions for me? thank you
pengen gini

1 Like

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

Hello,

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

image

Are you seeing an excel icon?

image

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

It just did a quick search…

:)

1 Like

Hello @glv , thank you for replying. The data icon that I saved looks like this
image

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

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

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

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

2 Likes