03-16-2023 11:44 AM
I want to open the excel file while the program is running, but I kept getting an error or the program would stop. How do I see data being logged without having to stop the program?
See my attached code
Solved! Go to Solution.
03-16-2023 12:00 PM
If you open the spreadsheet file in Excel, it will block access to it.
You could probably use the Report Generation Toolkit to log data to a real Excel file (.xlsx), and I think you will have options to show or hide the Excel window.
03-16-2023 12:21 PM
If you want to use Excel, you'll need to do what Gregory said and use the Report Generation Toolkit, which can interface with Excel using Excel's API.
If you just want to see data going into a file, use Notepad++. It doesn't block access to a file when it has it open. It won't update in real time, but you can refresh the view and see changes made to it. The VI you're using saves the spreadsheet file after each write, so Notepad++ will be able to see it. I don't know if it would see unsaved changes to a file.
03-16-2023 12:24 PM
Your program never does anything with an Excel file. You are using the LabVIEW "Write Delimited Spreadsheet" function which writes an "ordinary" Text file using 1D or 2D Arrays of data, separating the "columns" of the Arrays in the text file with (by default) a Horizontal Tab character, and ending each "row" with an End-of-Line (usually <CR><LF). If the separator character is changed to a Comma, such a Text file is called a "Comma-Separated-Value" file (abbreviated ".csv"), which Microsoft displays with an Icon that "suggests" this is an Excel File. It is not.
The Delimited Spreadsheet File has another unusual "feature" -- every time you call the file, you open it, write to it, and close it. It is designed that way.
If you were really writing to an Excel File (which you can do by using the Report Generation Toolkit, or third-party software), Excel would stay open and you could watch your data being added.
Note that there is nothing to stop you from creating an Array Indicator on your LabVIEW Front Panel and writing to both the Indicator (so you can "see" the data) and to the Delimited Spreadsheet File (so you can "save" the data).
Bob Schor
03-16-2023 10:58 PM
Thanks Mr. Bob Schor for this information and thanks everyone else.