Pages: [1]   Go Down
Author Topic: Writing in to excel sheet  (Read 1011 times)
0 Members and 1 Guest are viewing this topic.
DELHI
Offline Offline
God Member
*****
Karma: 8
Posts: 836
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear all.

can some help for programming below.

I wanna write the perametre like time and date from Arduino code to excel sheet. Can some one suggest me how to configure arduino to write into Excel sheet. How programing code look like

Logged

AMPS

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3031
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The arduino cannot write into an excel sheet.

Excel software runs on a computer, not an arduino.

Arduinos can send data using conventional serial protocol to other devices, including computers.
As far as I know,  excel has no method available to collect this data itself.

You would need to write a program to run on your computer,   to collect the serial data being sent by
the arduino,   and then put that data into excel,  or write it into a file which excel can read.
Logged

DELHI
Offline Offline
God Member
*****
Karma: 8
Posts: 836
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can you tell me the where i can get code for loging data either in excel sheet or text file


The arduino cannot write into an excel sheet.

Excel software runs on a computer, not an arduino.

Arduinos can send data using conventional serial protocol to other devices, including computers.
As far as I know,  excel has no method available to collect this data itself.

You would need to write a program to run on your computer,   to collect the serial data being sent by
the arduino,   and then put that data into excel,  or write it into a file which excel can read.
Logged

AMPS

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3031
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well here is two methods:

(1)  Write your data into a plain text file with commas between the fields,  onto an SD card connected to the arduino.
There are plenty of online tutorials and code examples for this.   Take the SD card out of the arduino. Stick it into the
computer.  Use excel to input the data from the "CSV" format file on the SD card.

(2)  Learn how to use "Processing" or some other language on the PC capable of collecting data from the serial port.
Send the data from the arduino to the computer,  collect it with a program you have written,  and save on the PC
in a CSV format text file.   Then read it into excel.
Logged

DELHI
Offline Offline
God Member
*****
Karma: 8
Posts: 836
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can you explain me where i can get more idea over 2nd topic


well here is two methods:

(1)  Write your data into a plain text file with commas between the fields,  onto an SD card connected to the arduino.
There are plenty of online tutorials and code examples for this.   Take the SD card out of the arduino. Stick it into the
computer.  Use excel to input the data from the "CSV" format file on the SD card.

(2)  Learn how to use "Processing" or some other language on the PC capable of collecting data from the serial port.
Send the data from the arduino to the computer,  collect it with a program you have written,  and save on the PC
in a CSV format text file.   Then read it into excel.
Logged

AMPS

Solna, Stockholm, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 11
always willing to say stupid stuff
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is not impossible, just very hard and demands some extra components it seems. At least at a quick glance on this link http://social.technet.microsoft.com/Forums/is/ITCG/thread/ccdaded5-fb27-42a2-85e2-eca8aab4037e

That said I think method 2 above is the way to go
Logged

DELHI
Offline Offline
God Member
*****
Karma: 8
Posts: 836
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear all,

I made it work using python .

software needed pyserial v2.5 software and usb to serial converter .



code  to run on python:

import serial
import csv
import os

os.path.abspath("F:\BK -cd1\python")


logfile="time.csv"


def main():
    pass

if __name__ == '__main__':
    main()
    COUNT=0
    while(COUNT<=60):
      ser=serial.Serial()
      ser.port=12
      ser.baudrate=9600
      ser.open()
      x=ser.read(16)
      foo=open("fool.txt","a+");
      print x
      foo.write(x)
      foo.write("\n")
      foo.close();
      ser.close()
      COUNT=COUNT+1
      if(COUNT==60):
        COUNT=0
Logged

AMPS

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2073
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

FYI - looong time back I used this gadget:

http://www.parallax.com/tabid/393/default.aspx

It writes directly ("in real time") to the excel sheet from any mcu via serial, just do follow the required format.. smiley
Logged

Pages: [1]   Go Up
Jump to: