LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write data from txt file to existing Template excel file

Hi 

I create Template file in excel 2016 , 

I have txt file that include data inside it ( see attach file Demo.txt)

what I want to do that take the data from txt file and write it to existing Template excel file

the data inside the txt file separate with comma  , 

the data should save starting from row2

Template Excel file also attached 

who Can I do that in labview ?

I am using labview 2015

 

appreciate your help 

Regards 

Wisam 

I am sending also pic 

 

 

 

 

Download All
0 Kudos
Message 1 of 2
(1,912 Views)

Yes, you can definitely do this in LabVIEW, especially if you have the version that included the Report Generation Toolkit (RGT), which gives you the ability to open Excel Workbooks based on a Template and fill in rows from LabVIEW Data.

 

Your data file, demo.txt, is a Comma-separated Variables file (which often has the extension .csv, one that Microsoft has "hijacked" and given an icon that looks like an Excel icon).  These files are easily read with the Read Delimited Spreadsheet function (on the File I/O Palette), though you need to specify a comma (",") as the delimiter.

 

There are numerous examples showing how to use the RGT.  A particularly thorough one can be found in this Forum here -- this example doesn't use a Template, but you can fix that by wiring the Template path into the appropriate input of New Report.  Note that you can use a different name for the Output file if you don't want to overwrite the template.  I believe the Example shows how to save data starting at other than the very first row.  [Oops -- no, it doesn't -- it shows how you can create row and column headers before writing your data, which, in your case, might be even simpler than worrying about opening a Template file and having to specify the starting row for the output ...].

 

Go ahead and try playing with the Read Delimited Spreadsheet function to read the data file and the Report Generation Toolkit functions to output an Excel Workbook.  Come back here with your code if you run into a bug/problem you can't figure out (don't be afraid to use the LabVIEW Help on any function you don't understand, to look up LabVIEW Examples, or to search the Web and/or the Forum ...).

 

Bob Schor

0 Kudos
Message 2 of 2
(1,897 Views)