alchoi01 Posted October 22, 2005 Report Share Posted October 22, 2005 I have a created an output text file of my data using Labview. I need to be able to export this file into a specific sheet of my excel template. I need to write the text file first because it is not simply an array, but a combination of several strings and arrays. This is how the program was originally written, and i do not know how to change this. I am looking for an easy way to export the existing output file (.txt) into my excel workbook after the initial creation of the text file. Quote Link to comment
Michael Aivaliotis Posted October 22, 2005 Report Share Posted October 22, 2005 I have a created an output text file of my data using Labview. I need to be able to export this file into a specific sheet of my excel template. I need to write the text file first because it is not simply an array, but a combination of several strings and arrays. This is how the program was originally written, and i do not know how to change this. I am looking for an easy way to export the existing output file (.txt) into my excel workbook after the initial creation of the text file. If your text file is a tab delimited file with new rows seperated by carriage return and linefeed, then you can simply open it from Excel. Excel should recognize the format and load it up without problems. The other option is to do activex com to Excel and pump the data directly into Excel. This option may take several days or weeks to get working (if you've never done this type of thing before). This method is cool, you will grow as a programmer and you can impress others with the new knowledge you have attained. Of course your boss might yell at you for pushing out the deadline on delivery... Quote Link to comment
alchoi01 Posted October 24, 2005 Author Report Share Posted October 24, 2005 Thanks for the help. I will try using ActiveX for the first time. In the mean time, our current process requries chyanging the name of the output text file, then running an excel macro to import the data. I know how to run the excel macro via LabView, but is there a function to change a file name? It is a .txt file. Quote Link to comment
WMassey Posted October 24, 2005 Report Share Posted October 24, 2005 Thanks for the help. I will try using ActiveX for the first time. In the mean time, our current process requries chyanging the name of the output text file, then running an excel macro to import the data. I know how to run the excel macro via LabView, but is there a function to change a file name? It is a .txt file. Here's a fast way to start using the ActiveX method: Excel Toolkit (GOOP) It works really slick! Also... LAVA Forums > LabVIEW > The LabVIEW FAQ > Miscellaneous > How do I rename a file? Quote Link to comment
Michael Aivaliotis Posted October 24, 2005 Report Share Posted October 24, 2005 Thanks for the help. I will try using ActiveX for the first time. In the mean time, our current process requries chyanging the name of the output text file, then running an excel macro to import the data. I know how to run the excel macro via LabView, but is there a function to change a file name? It is a .txt file. There is no need to rename the file. Just open it in Excel. Have you tried this? WMassey Thanks for the link... Quote Link to comment
peteski Posted October 25, 2005 Report Share Posted October 25, 2005 There is no need to rename the file. Just open it in Excel. Have you tried this?Thanks for the link... A very "quick and dirty" trick I've played on Windows based machines is to give a tab delimited text file an .xls extension. This causes Windows to automatically open the text file through excel when the user double clicks on the file. It DOES mean that if the user makes some modifications to the file through excel, they must be wary as to whether they save the file back as a text file or as an excel file. Excel does inform them of this when they attempt to close or save the file, but sometimes the user might not bother to read all of the information in a dialog. Of course, inserting data directly into Excel through activeX has its advantages (e.g. formatting, formulas, and other fancy stuff!), but its just not as "quick" or as "dirty." -Pete Liiva Quote Link to comment
Jim Kring Posted October 25, 2005 Report Share Posted October 25, 2005 A very "quick and dirty" trick I've played on Windows based machines is to give a tab delimited text file an .xls extension. This causes Windows to automatically open the text file through excel when the user double clicks on the file. Also, you can also have Windows open the file in Excel by calling it from the command-line using System Exec. Just pass the path to the file, as the command string and let Windows do the rest. This method will also work if your have OpenOffice registered as the handler for XLS files. Quote Link to comment
alchoi01 Posted October 26, 2005 Author Report Share Posted October 26, 2005 Thanks for the help guys. I know about opening text files via excel. My goal is to "dummy proof" this process and have LabView automate as much of the data transfer to excel as possible instead of relying on our rather inept operators. So far the LabView program creates an output text file. I need to then transfer that text file into a specific sheet of an existing excel workbook either directly or by renaming the text file and running an existing macro through excel. I'll try playing with the ActiveX and GOOP functions. I have never used ActiveX, though, so any tips will be greatly appreciated. Quote Link to comment
WMassey Posted October 27, 2005 Report Share Posted October 27, 2005 I'll try playing with the ActiveX and GOOP functions. I have never used ActiveX, though, so any tips will be greatly appreciated. You don't really need too much, if any, ActiveX experience to use the Excel Toolkit that I referred to earlier. That's been done for you. I've attached an example that uses a VI I pulled out of a working system. I've added a dummy front end to generate some fake data for it to operate on. You can see some of the stuff you can do with the toolkit in regards to generating Excel spreadsheets. This example is in LV 7.1.1 and I believe it includes copies of all the VIs needed to run it. Download File:post-2800-1130413684.zip Quote Link to comment
torekp Posted May 22, 2006 Report Share Posted May 22, 2006 Excel Toolkit (GOOP) It works really slick! Oh, NOW you tell me, now that I've reinvented the wheel Thanks for the link - now how do I get the LV8 version of the GOOP toolkit? Quote Link to comment
orko Posted May 23, 2006 Report Share Posted May 23, 2006 Excel Toolkit (GOOP) A tip for those that try this toolkit with LV 7.1/8.0: I had to change one of the property nodes in four VIs to make this library mass compile. Inside excel.llb, you'll find the "Excel write string/numeric" and "Excel read string/numeric" VIs have a broken property node pointing to a "Range->Value" property. Change this to "Value2" and the VIs should work. This IS a slick toolkit though! :thumbup: Joe (orko) Quote Link to comment
george seifert Posted May 23, 2006 Report Share Posted May 23, 2006 A tip for those that try this toolkit with LV 7.1/8.0:I had to change one of the property nodes in four VIs to make this library mass compile. Inside excel.llb, you'll find the "Excel write string/numeric" and "Excel read string/numeric" VIs have a broken property node pointing to a "Range->Value" property. Change this to "Value2" and the VIs should work. Joe (orko) I think the problem is an Excel version issue rather than a LabVIEW version issue. I had the exact same problem using the LV Report Generation Toolkit when I switched to Excel 2003 from Excel 2000 (or maybe it was Excel 2000 from the previous one). George 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.