Pages: [1] 2   Go Down
Author Topic: Excel  (Read 1909 times)
0 Members and 1 Guest are viewing this topic.
Norway
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26638
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there a way to get them into 2 colones?
Yes there is, don't use println for every item.
And post code.
Logged

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

New Jersey
Offline Offline
Faraday Member
**
Karma: 72
Posts: 3764
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Like:

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

You obtain something like

Code:
1,25
2,54
3,44

Also, give the file the extension "csv".
Logged

Norway
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 654
Posts: 50952
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

New Jersey
Offline Offline
Faraday Member
**
Karma: 72
Posts: 3764
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 654
Posts: 50952
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Edison Member
*
Karma: 50
Posts: 1704
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

What do you mean ?
Logged

Saskatchewan
Offline Offline
Sr. Member
****
Karma: 19
Posts: 364
When the going gets weird, the weird turn pro. - Hunter S. Thompson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Norway
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys smiley
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 smiley

But again guys, thanks for your help so far smiley

-Andy
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1] 2   Go Up
Jump to: