LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert labview data to excel

hi,

 

I would like to convert Lab view data to Excel. i have attached a excel file as an example on how i would like the data to be like.

 

thanks!labview.jpg 

0 Kudos
Message 1 of 9
(4,672 Views)

Hi YMC,

 

your "iconized" screenshot is nearly useless - all we can see is a spreadsheet type of window...

 

Start with the easiest solution:

Save your data as csv-file using the WriteToSpreadsheetFile function (or ArrayToSpreadsheetString followed by WriteTextFile)...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(4,670 Views)
If you use the write to spreadsheetfile function, with a \t delimiter, and save it to a file with a .xls extension -- you can open it in Excel directly.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




Message 3 of 9
(4,644 Views)

So I am having an issue with something seemingly simple. I am not good with LabView however I am using LabView 2009 and Excel 2007. I attached the example code which is meant to just measure a volatge from the Keithley. Now I am trying to have the data logged in excel as opposed to labview. I think I want to use the write to spreadsheet function but am a bit unsure. So if there is an easy fix to the current code to make the data accesible in excel I would be grateful to know how this is supposed to be done. I am also a bit unsure if the array currently is a 1D or 2D which might be throwing it off when trying to write to spreadsheet. Since you likely do not have the instrument I understand you wont be able to run it but I have no problem with communication between the electrometer and computer and the usb connector and the computer or the electromter and usb.

0 Kudos
Message 4 of 9
(4,373 Views)

There is no code that writes to a file in your VI. 

 

It's easy though, Write to Spreadsheet File.vi accepts 1D and 2D arrays and writes it to text file.  Check Help > Find Examples... for many examples on writng and reading data to and from files.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 5 of 9
(4,355 Views)

Yes I know it is not in there. I was messing around with it after reading through the examples and could not figure it out. I was trying to put it in place of the data readout. My thinking was since I wanted the data to be in the spreadsheet to readout directly into the write to spreadsheet vi but that didn't work. I guess my real question is where in my block diagram should the write to spreadsheet.vi go? I should be able to figure out the connections and such from that, but my issue has been trying to figure out where it should go to properly take data and turn it into a spreadsheet.

0 Kudos
Message 6 of 9
(4,315 Views)

@Dan Stewart wrote:

 I guess my real question is where in my block diagram should the write to spreadsheet.vi go?


How about connected to the wire that goes to the "Data" indicator? You know, the one that actually has your data. You said "My thinking was since I wanted the data to be in the spreadsheet to readout directly into the write to spreadsheet vi but that didn't work." What didn't work? Is that where you connected it? Did you get a broken wire? Did you wire a path? If not, did it ask for where to save the data? Did you get an actual file?

 

 

As said, the Write to Spreadsheet File will create a text file. If you want an Excel workbook, you need to either buy the Report Generation Toolkit, or look at the shipping examples on how to write to Excel (Help -> Find Examples and search for "ActiveX"). You can also look at all the links in the Excel thread. NOTE: DO NOT POST QUESTIONS IN THE EXCEL THREAD.

0 Kudos
Message 7 of 9
(4,306 Views)

Yes that is where I had it connected and yes it was giving a broken wire. I re-did that wiring again this morning and its running just fine, so not sure where my problem was prior to this morning from doing the same thing. Sorry for asking a simple question, thanks for the responses and help though. Now need to work on making that data split into columns in excel instead of each cell haivng 3 pieces of information. Time for more help reading. Thanks though guys.

0 Kudos
Message 8 of 9
(4,294 Views)

You may have accidentally connected something the first time that resulted in a hidden wire behind the VI.  That can sometimes cause a mysterious broken wire.  If you're new to labview, WIRE CAREFULLY.  Also move things around if something seems wrong.  That will often uncover a hidden wire or constant you accidentally covered. You'll soon learn the techniques.

 

As far as your columns go, you need to format your text using the TAB as a column delimeter and the RETURN/NEWLINE as row delimiter for Excel.  Write to Spreadsheet handles the RET/NEW and has an input for the column delimiter but it defaults to COMMA for simple text files.  Try changing it to TAB and play with some string formatting functions to get your feet wet in the wonderful world of file formats.

 

EDIT:  You may have noticed that the Write to Spreadsheet VI is white, not yellow.  That means it is not a primitive (yellow) and that you can open it and descend into its code and see how it works.  Open it up and see.  If you modify it for your own use, you can rename it and use it again when you need the same functionaity in the future...

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 9 of 9
(4,265 Views)