Sd card data excel file

Hello,

I am trying to send data to an SD card.
I have results in the serial port in an arranged way but when I open the file from the SD card, it saves differently.
I have attached the pictures.
Can anyone please help.

Thanks

IMG_4660.JPG

IMG_4661.JPG

Serial.println(pressure_mmhg);

println for pressure

SensorData.print(pressure_mmhg);

just print for file

Is that the difference?

Hello,

I changed it to println. and it is giving results like this :

IMG_4671.JPG

I changed it to println. and it is giving results like this :

You changed your code. It still doesn't do what you want. And, you want us to guess why it doesn't. I'll pass.

The difference between what you see in Serial Monitor and Excel is the way the data is handled. To Excel tab is not data so is ignored. When I write data to an SD card I write the data in CSV format. Makes it very easy to import into Excel. Do you want pressure, time and date in separate columns? Give an example of what you want to see in Excel. What are you trying to achieve?

can you please check the code and correct me where I ma going wrong.

The code that you modified but did not post? The answer is still no.

    SensorData.println(pressure_mmhg);
    SensorData.print("\t");
    SensorData.print(now.year(), DEC);

So, you didn't understand what the difference is between print() and println(). Time for more study.

Put a delimiter between pieces of data. I use "," (comma). You can use space or tab as well. Import the data to Excel as text file and choose comma for the delimiter. Since you use the extension .CSV Excel knows what to expect if the delimiters are comma.

SensorData.print(pressure_mmhg);
    SensorData.print(',');                // comma delimiter
    SensorData.print(now.year(), DEC);
    SensorData.print('/');
    SensorData.print(now.month(), DEC);
    SensorData.print('/');
    SensorData.print(now.day(), DEC);
    SensorData.print(',');               // comma delimiter
    SensorData.print(now.hour(), DEC);
    SensorData.print(':');
    SensorData.print(now.minute(), DEC);
    SensorData.print(':');
    SensorData.println(now.second(), DEC);    // CR/LF for end of record (println)
    SensorData.close();

I don't know why it writes two files. It looks, to me, like it writes only one record each time it runs.

get it that print ln() prints it to the next line.

No. What println() does is print on the current line and then move to the next line.

But when I give :

I find it hard to believe that SensorData.print(now.year(), DEC); results in "2016/26/4 12:00:00" being added to the file. It's hard to see what happened to the tab.

As to the multiple file issue, without seeing ALL the serial output, we can't comment on that. I'd guess that something is causing the Arduino to reset.

SensorData.print('\t');                // comma delimitercomma ?

I have tried using both the comma and tab. Either it prints 0.122016/26/42:0:09

or 0.122016/26/4 2:0:09

It is impossible to tell from your examples of what the data looks like in Excel whether you are seeing it in a single column or in multiple columns.

Use commas as the delimiter between data items. Name the file with an extension of .csv then open it in Excel. How many columns of data do you see and what does it look like ?

I have attached the excel sheet.

No you haven't

Hello,

The forum does not allow me to upload excel files. I have tried saving the file as .csv also. However , in notepad (.txt file, it prints well) I see the pressure and year/month/date in a single column and time in another column. Instead of seeing the data in 3 columns, it is printing in two.

I want to create multiple files each time I restart the arduino.

However, I end up creating two files for each recording I do. There are files being created as DATA00.csv and DATA01.csv for one recording. Can you please help me with this too.

Thank you

I have tried saving the file as .csv also

Create the .csv file, rename it to .txt and attach it to a post here Make sure that you use the version of the program that outputs the comma separator and not a tab. For completeness post the whole program here even if you have posted it before.

And post ALL of the serial output. This guessing crap is getting OLD.

     Serial.println(pressure_mmhg);
     Serial.print(',');

Why the CR/LF after the first value?

The code you posted creates DataXX.csv in setup() where XX is some numeric value starting at 0. Then. loop() opens/creates TPData.csv and writes to it. If you want to use the same file that setup() created, you are going about it wrong.

Hello,

Can you please tell me how to correct the mistake.
I am totally confused now.

Also, I have attached captures of how data looks in Excel.

This creates two files as attached. I have attached the complete serial monitor data too.

The first 2 files don't have commas in them whereas the screen shot of the serial monitor does, albeit with some extra linefeeds. Are you sure that you are uploading the files created by the program ?

As an experiment, where you output a comma output some text such as "a comma" instead and run the program. Does the text appear in the file ?

Can anyone tell me what the problem is.

You clearly have not formatted the second column correctly.

Also, it is creating multiple files like DATA00 DATA01 DATA02 DATA03 DATA04 DATA05 for 2 recordings . How to get one file per recording?

Without seeing your serial output? Hell, no!