LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel template for spreadsheet

Solved!
Go to solution

Hello all. With your help I am near completion. I am using a "write to spreadsheet" and would like to know how I can create a header, so to speak. The operator's will be expected to create a new file each time the Vi is run. So, along the top I need each column to have written "Capacitance" for column 1, "Impedance" for column 2, and "Temperature" for column 3. So, as the Vi is run the top row populates with the names given above, then the data will be written under each of the headings.

 

The second thing, and I don't know if this is possible, is that I would like the spreadsheet to have the first two columns be in scientific notation form, and the last one in general form, on the actual spreadsheet. I don't know much about Excel but I think what I would like to do is create a template, have the data written to it and then force the operator's to perform a save as so the template is left as it was before the test. Hopefully this makes sense. I have attached what I am "playing" with, trying to make it work.

 

Thanks much.

0 Kudos
Message 1 of 6
(4,790 Views)

Do you even read what we post in trying to answer your questions?  I basically showed you now to do this two days ago.  And, if you've been looking at other posts here on the Forums discussing "Excel" or "Spreadsheets", you would have seen someone (myself, most likely) trying to explain that "Excel" and "Spreadsheet" are completely different things!

 

"Excel" is a program made by Microsoft that works with a data format usually referred to as a "Spreadsheet", but in Excel terminology, this is a Worksheet, and the file containing it is a Workbook (whose extension is .xls or .xlsx).  Data are stored on a Worksheet in "Cells" having addresses in the form "A1" (first column, first row), and the data in the cells can have a variety of formats, colors, font attributes, etc.

 

LabVIEW provides the ability to write a text file (meaning that it is plain ASCII text, separated by <CR><LF>) that can accept 2D numeric or string data and write it as strings, separating the columns with a specified character (default is Tab) and separating rows with <CR><LF>.  If the user chooses to use a Comma as the column separator, the file that results is often called a .csv (Comma-separated Values) file.  If Excel has been installed, it "captures" the .csv extension and associates itself with this file format, fooling the naive user into thinking that this Text file is an Excel file.  Yes, Excel can read such a file and can even manipulate it, but it remains a Text-only file unless the user chooses to save it as a native Excel .xls(x) file.

 

If you want to do fancy Excel-type things, you need to use Excel, which is most easily done with the Report Generation Toolkit (as I showed you Thursday).  If you only need to read and write string data, you'll be fine with LabVIEW's Read/Write Spreadsheet.  Be aware, however, that when you write Floating Point data as text, you determine the precision of the data at the time of writing.  For example, if you wrote the value of pi to a Spreadsheet file and chose to write it using three digits of precision (3.142), you would not be able to read it back with its full precision (3.14159...), as WYSIWYG (What You See Is What You Get).  On the other hand, if you wrote this to an Excel cell, the full value would be stored in Excel, and when you read it back, no matter how it appeared when you viewed the WorkSheet (as the "view" is set by the Cell's Format), you'd get all the digits back that you put into the Cell.

 

I will admit that I used to give short shrift to LabVIEW's Spreadsheet functions (I've never used them in my own work), but I've now learned how to use them (primarily to be able to help LabVIEW "students" get started).  They are fine, and can do more than I originally gave them credit for, but if you want "fancy", you need to use Excel, and the easiest way to do that is to use the Report Generation Toolkit.

 

Bob Schor 

 

 

Message 2 of 6
(4,768 Views)
Solution
Accepted by topic author ceilingwalker
If my understanding matches with your requirements you can follow this.... instead of confusing with excel and spreadsheet..

Go with spread sheet... if your application is simple, the reason is you don't require extra tool kit /ActiveX usage in spreadsheet which you need in excel....

Steps to follow

1.create a spreadsheet file with headers in your intialization steps
2.then append the data in the same fIle
this can solve your problem...
Message 3 of 6
(4,667 Views)

I agree with Palanivel -- if your problem is simple, you can use the LabVIEW "Spreadsheet" functions instead of the Report Generation Toolkit and Excel.  My example two days ago to your earlier post showed exactly how to do this using both methods.

 

BS

Message 4 of 6
(4,596 Views)

Yes, that worked. Thank you much.

0 Kudos
Message 5 of 6
(4,448 Views)

Yes Sir, I am using the spreadsheet.

0 Kudos
Message 6 of 6
(4,430 Views)