Go Down

Topic: Excel (Read 2095 times) previous topic - next topic

cbrandy

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

AWOL

Quote
Is there a way to get them into 2 colones?
Yes there is, don't use println for every item.
And post code.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

wildbill

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

tuxduino

Like:

Code: [Select]

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


You obtain something like

Code: [Select]

1,25
2,54
3,44


Also, give the file the extension "csv".

cbrandy

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

PaulS

Quote
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.

dxw00d


Quote
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.

wildbill

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

dxw00d

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.

PaulS

Quote
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.

el_supremo

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

tuxduino

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


What do you mean ?

Jimmy60

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.

cbrandy

Hi guys :)
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 :)

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

-Andy

tuxduino

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 ","

Go Up