Grv Chy Posted July 2, 2020 Report Share Posted July 2, 2020 Hello , I am trying to Export data from LabVIEW to an Excel file(.csv) in real time. I Need to see the data in a real time , which are written in the Excel without Closing the Excel. my Problem is i can see the real time data writting in LabVIEW . But in Excel i can see the data only after stoping my LV program. Is there any way to watch real time data writting in each column the Excel. I have attached my LV program. Write_CSV_date_time.vi Quote Link to comment
Mefistotelis Posted July 2, 2020 Report Share Posted July 2, 2020 What you want is to flush your output file occasionally. File writes are buffered, and performed only when enough data has gathered, or the file is being closed. In C, flushing is done by fflush(); for LV - someone else will have to answer. Quote Link to comment
Grv Chy Posted July 2, 2020 Author Report Share Posted July 2, 2020 Yes, Mefistotelis . I want to see each data , which ar send to excel in real time in the excel sheet. Quote Link to comment
Bryan Posted July 2, 2020 Report Share Posted July 2, 2020 There is a "Flush File" function in the "File I/O >> Adv File Funcs" menu that you can have execute after every write. However, If you already have Excel open to view the CSV file, I don't believe that Excel will automatically update your spreadsheet contents every time the file changes if that is what you're trying to do. I haven't tried that myself. If the above doesn't work, it may be that Excel doesn't constantly monitor the file and automatically update. You could try using the "Refresh All" button in Excel under the "Data" menu, but you'd have to do this manually. Additionally, you'd have to open your reference to the file with permissions configured in such a way that it doesn't block other applications from using the file if another already has it open. Someone more experienced in Excel and actively monitoring file contents may be able to provide more info. Quote Link to comment
Grv Chy Posted July 2, 2020 Author Report Share Posted July 2, 2020 Hello Bryan, However, If you already have Excel open to view the CSV file, I don't believe that Excel will automatically update your spreadsheet contents every time the file changes if that is what you're trying to do. I haven't tried that myself. --->>>>> yes i am trying to keep ma excel sheet open while data are updating in real time, which i receive per second from LabVIEW. Quote Link to comment
crossrulz Posted July 2, 2020 Report Share Posted July 2, 2020 Excel actually locks the file so only it can edit it. So if you close the file in LabVIEW, you will not be able to reopen it to add more data. Yes, I have personal experience with this. Since you are using a CSV, I would recommend something like UltraEdit. UE edits backup files and it will let you reload files that have changed while you have it open. I'm not sure if Notepad++ does the same. Quote Link to comment
Grv Chy Posted July 2, 2020 Author Report Share Posted July 2, 2020 Thank you for the suggestion, Can you please elaborate it . If possible LV program, where you used this UE. Quote Link to comment
crossrulz Posted July 2, 2020 Report Share Posted July 2, 2020 UltraEdit is just a text editor (a REALLY good one, in my opinion). So I have had test results being saved to a text file and had the result file open in UE. I can look all I want and then reload the file whenever I want to see the updates. Quote Link to comment
Grv Chy Posted July 2, 2020 Author Report Share Posted July 2, 2020 Thank you for the explanation... but for me i must write the data in excel(.csv) and same time able watch the data update like i do in labview.... Quote Link to comment
crossrulz Posted July 2, 2020 Report Share Posted July 2, 2020 CSV is a text file. So why are you stuck with Excel? It will not do what you want. What's wrong with making another viewer? Push back on this requirement to figure out what the real goal is. Quote Link to comment
Bryan Posted July 2, 2020 Report Share Posted July 2, 2020 I'm not sure that you're going to be able to (easily) do what you want to do without some advanced programming to automate/manipulate Microsoft Excel (for instance, using ActiveX or dotNET), even then - I'm not sure it's possible to do what you're trying to do as it involves Microshaft software, over which LabVIEW will have limited ability to control. I agree with 'crossrulz'. Whomever is pushing this requirement may need to reevaluate the need for this functionality. Quote Link to comment
Gribo Posted July 2, 2020 Report Share Posted July 2, 2020 You should use the Excel .NET API. You will see your data as it is added to the spreadsheet. Also, you can do this with OpenOffice/LibreOffice if you don't want to pay for Excel. Quote Link to comment
jacobson Posted July 2, 2020 Report Share Posted July 2, 2020 I agree that you should probably push back a bit on the requirements. If you want to get real weird with it, I've worked with a group that did all of their hardware interaction in LabVIEW, built that code into a DLL and then called it from an excel macro that was continuously running. Quote Link to comment
Grv Chy Posted July 8, 2020 Author Report Share Posted July 8, 2020 On 7/2/2020 at 6:38 PM, jacobson said: I agree that you should probably push back a bit on the requirements. If you want to get real weird with it, I've worked with a group that did all of their hardware interaction in LabVIEW, built that code into a DLL and then called it from an excel macro that was continuously running. Hello Jacobson, Can you please help me to get this DLL and use it LabVIEw, may be you have that code. Quote Link to comment
Grv Chy Posted July 8, 2020 Author Report Share Posted July 8, 2020 On 7/2/2020 at 6:01 PM, Gribo said: You should use the Excel .NET API. You will see your data as it is added to the spreadsheet. Also, you can do this with OpenOffice/LibreOffice if you don't want to pay for Excel. Hello Gribo, do you somthing like code or exmple, where i can see my data in real time. It will be very helpful for me. Quote Link to comment
Gribo Posted July 8, 2020 Report Share Posted July 8, 2020 Here you go. This is not a production code. You will have to close references when you are done with a specific object. 2 things to note: 1. Excel, like VB is 1 based. 1st index is 1. 2. Don't leave an empty property node input. Wire a 'missing' type to any gray (optional) input that you don't use. 1 Quote Link to comment
Grv Chy Posted July 9, 2020 Author Report Share Posted July 9, 2020 22 hours ago, Gribo said: Here you go. This is not a production code. You will have to close references when you are done with a specific object. 2 things to note: 1. Excel, like VB is 1 based. 1st index is 1. 2. Don't leave an empty property node input. Wire a 'missing' type to any gray (optional) input that you don't use. Thank you Gribo. I have attached my VI. But i got 2 Problem: 1. I was not able to insert property node "Type" > "missing". 2. I get error from my Invoke node "Add". Do you ha ve any idea?? csv_update.vi Quote Link to comment
Gribo Posted July 10, 2020 Report Share Posted July 10, 2020 Type object is in the System namespace. Click .NET connectivity -> Invoke node -> Select class -> System -> Type -> Missing Quote Link to comment
Grv Chy Posted July 10, 2020 Author Report Share Posted July 10, 2020 4 hours ago, Gribo said: Type object is in the System namespace. Click .NET connectivity -> Invoke node -> Select class -> System -> Type -> Missing Great man it is working… Now i just Need to find out how can i write random number continously in each row and column in each 500 ms. Quote Link to comment
Grv Chy Posted July 10, 2020 Author Report Share Posted July 10, 2020 On 7/2/2020 at 4:56 PM, crossrulz said: CSV is a text file. So why are you stuck with Excel? It will not do what you want. What's wrong with making another viewer? Push back on this requirement to figure out what the real goal is. Hello crossrulz, The actual target is to see each data in .csv Format but i am not able to find real time update in .csv , when LabVIEW send a data in each Minute, it should be also updated in csv while it is opened. I Need to monitor each data send from LabVIEW while csv is receiving it. I am not able Keep open csv file and monitor while it is receiving data from LV. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.