Excel

Hi all.
I made a temperature datalogging with SD card.
For now, I just have logged number of logging and temperature.
id.......Temperature
1.......22.31
2.......22.90
3.......23.47

Now I want it to import data to excel.
But as I programmed, id and temperature goes into one colone.
Is there a way to get them into 2 colones?

-Andy

Is there a way to get them into 2 colones?

Yes there is, don't use println for every item.
And post code.

Put a comma between them and import it into Excel as a csv file.

Like:

Serial.print(id);
Serial.print(',');
Serial.println(temperature)

You obtain something like

1,25
2,54
3,44

Also, give the file the extension "csv".

Hi.
Thanks for your reply.
Here is the code i have to store to memory:

File dataFile = SD.open("datalog.csv", FILE_WRITE);

if(dataFile)
{
dataFile.print(id);
dataFile.print(',');
dataFile.println(sensor1);
dataFile.close();

// print to the serial port too:
Serial.print(id);
Serial.print("\t");
Serial.print(sensor1);
Serial.print("\t");
Serial.println(gjennomSnitt);

//Increment ID number
id++;
}

When i imported the data, I got what I wanted.
But is there a way to solve this without importing??

-Andy

But is there a way to solve this without importing??

Yes, there is. Open a .xls file in notepad. See all the special characters? Figure out what they mean, and write the corresponding data to the file you create, with the .xls extension.

PaulS:

But is there a way to solve this without importing??

Yes, there is. Open a .xls file in notepad. See all the special characters? Figure out what they mean, and write the corresponding data to the file you create, with the .xls extension.

I started to do that once, and gave up. This document may help if you want to take that route - http://www.openoffice.org/sc/excelfileformat.pdf.

As long as it has a csv extension, Excel will open it without a need to import

I know what the OP means though. If you double-click on a csv file, sometimes Excel will put each line in to a single cell.

If you double-click on a csv file, sometimes Excel will put each line in to a single cell.

That depends on how you've told excel to handle csv files. I don't think that excel defaults, properly, to expecting a comma between the comma separated values in the csv file. For some reason, it expects, IIRC, that the c stands for semicolon.

I've used the Arduino to generate CSV files on a uSD card. Double-left-clicking on the filename immediately opens the file in Excel with each Comma Separated Value entered in a new field. As far as I can remember, I haven't done any special setup in Excel to make it do that. This is with Excel 2010 on WIn7Pro.

Pete

But is there a way to solve this without importing??

What do you mean ?

If all you want to do is make graphs consider trying gnuplot (www.gnuplot.info). It wants data in a plain text file in columns. It's very fast. A week's worth of data from my log file has around 35,000 data points and the graph snaps onto my screen even on my old Toshiba laptop. It has zooming and auto ranging. It isn't the most straight forward thing but if you can program Arduino it shouldn't be too hard.

It even does Windows now.

Hi guys :slight_smile:
I mean when i take the SD card out from Arduino, deploy it to my computer, and then open it in Excel.
It´s saved as datalog.csv.
I tried cupple of things. Serial.print(","); Serial.print(´,´); String(id +" , "+ temp);.
Still same prob. When I open datalog.csv, I get the value like:
1, 22.5
2, 22.9
3, 22.1
4, 22.3...

But when I imported csv file, I got the data in 2 different columbs.
It´s really not a big issue, but it would be nice to get everything workout as I want to :slight_smile:

But again guys, thanks for your help so far :slight_smile:

-Andy

Don't put a blank after the comma.

On the Arduino side, Serial.print(id); Serial.print(","); Serial.println(value) is ok.

You can try "\t" in place of ","

It appears that the first column is simply a counter. It isn't really needed. (I recently went through this with my project.) It's trivial to number the data in the spreadsheet. If it goes to the first cell the row numbers should do it.

I don't know what you are doing with the data in the spreadsheet. Maybe you need each line numbered but if you think about it you might find that you don't.

Hi Jimmy60
The counter is not what I´m going to use. Later I insert a Real Time Clock Module.
So instead of counter, I´ll use time.

Very easy to parse data in Excel. Look for "Text to Columns" in the help. Can be parsed based on delimiters or fixed columns.

Here's how I get data into Excel columns, for experiments:

  • Serial.print() what I want to see, with a convenient delimiting character between data elements. A comma or a space usually works fine.
  • Copy and paste it into a single Excel column.
  • Data > Text to columns > Delimited > describe the delimiter

And, voila, it's in columns. For your application, you'll just want to be sure that your delimiter isn't a character that will show up in the timestamp you add later.