LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cannot store data in spreadsheet file.

Solved!
Go to solution

I have built this VI,It reads data from serial port and stores data in text file.But i want to log data in excel file directly.I ahve read other posts simililar  problem and implemented some solutions suggested but failed.Please help

0 Kudos
Message 1 of 16
(4,103 Views)

Hi pardhimegha,

 

have tuto how to send and receive your data.

 

https://www.youtube.com/watch?v=VpxBTtvCklo

 

Patrick

Certified LabVIEW Developer
0 Kudos
Message 2 of 16
(4,076 Views)

I have watched so many videos like this.

I dont have any problem regarding serial read or write... Problem is that i cant store data in spreadsheet file..

0 Kudos
Message 3 of 16
(4,060 Views)

Hi, pardhimegha

 

I ran your VI and have nothing to recevie, so it cannot store anything.

 

Because you use same port to send and receive data, it cannot work.

 

One com port have TX and RX. And you must connect those pins or use other devices/com to send/receive data.

 

 

Patrick

 

 

 

 

Certified LabVIEW Developer
0 Kudos
Message 4 of 16
(4,042 Views)

are you sure....??

 

coz I ran that VI and and I have stored readings in text file..

 here is file of readings ...

0 Kudos
Message 5 of 16
(4,030 Views)

Hi pardhimegha,

 

so what exactly is your problem?

 

At first you said you cannot store anything in your text file and now you show an example file with your device readings!?

 

- Your VI should do what you want it to do, but you should implement some error handling!

- Using BytesAtPort directly after VISAWrite will most often not yield in the answer of the command given by VISAWrite…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 16
(4,019 Views)

I have clearly stated that I want to store data in SPREADSHEET file..Which I am unable to do..

And my current VI stores data in TEXT file.

0 Kudos
Message 7 of 16
(4,012 Views)
Solution
Accepted by pardhimegha21

Hi pardhimegha,

 

rename your file from *.txt to *.csv and you're done…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 16
(4,007 Views)
Solution
Accepted by pardhimegha21

You could right click on your file and choose Open With->Excel.  Excel will be able to open up that file without any problems.

 

Here is a little more effiicient version of your code.  It uses the termination charcter to stop the VISA Read instead of asking how many bytes are at the port.  It also opens the file once before the loop and closes it once at the end.  And finally, you really should close your port after the loop.

 

Is that VISA Write even needed?  If you are leaving the Write Buffer control empty, you can just get rid of it.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 16
(3,991 Views)
Solution
Accepted by pardhimegha21
You are very confused about the difference between a spreadsheet file and an Excel file. A spreadsheet file IS a text file and has been pointed out, can be easily imported by Excel. To write a native Excel file, you must use ActiveX functions such as with the Report Generation Toolkit or the Write to Measurement File. In your case, I don't see the utility in getting that complicated when you don't need to.
Message 10 of 16
(3,982 Views)