LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Merge Excel Spreadsheets

I would like to merge portions of two Excel files using LabVIEW.  I am using LabVIEW 2012 and Excel 2010.  In my attachment, I want to merge rows 1 and 2 from the Excel 1 file with rows 3 and 4 of the Excel 2 file.  The desired result is shown in the Excel 3 file.  Any help will be greatly appreciated.

0 Kudos
Message 1 of 10
(5,070 Views)

Where is attachments?

 

Use Report Generation Toolkit (RGT) & read your required data (file-1 & File-2) and merge it (using array functions)

After that write it into other excel file.

 

If you don’t have RGT, use ActiveX functions to read your excel files.

Munna
0 Kudos
Message 2 of 10
(5,052 Views)

Which RGT VIs would you use?

0 Kudos
Message 3 of 10
(5,027 Views)
0 Kudos
Message 4 of 10
(5,020 Views)

Thanks.  This example will allow me to merge the data in the two excel files.  However, I would like to also reproduce all the cell formatting from the original files (cell borders, shading, etc.)  Sorry, I didn't mention this before.  Can this be done with the Report Generation Toolkit or do I have to use ActiveX?

0 Kudos
Message 5 of 10
(4,998 Views)

Yes..  you can do that.

 

Just check RGT vis for the same (Excel format vis). If your facing any problem, post your VI.

 

Munna
0 Kudos
Message 6 of 10
(4,996 Views)

The "problem" with the (otherwise very nice) Excel Format VIs is they are only "Set XXX", without the corresponding "Get XXX".  If you know in advance the formats of the cells you are merging, you can apply them when you write the data back out (it will be much easier to do this if you can work in "blocks" of cells, such as entire rows, entire columns, or the entire sheet, rather than format cell-by-cell).  On the other hand, if you do not know the format, and want to "copy" it from the cell/row/column/sheet that you read, I suspect you'll need an ActiveX call to get this information.

 

Bob Schor

0 Kudos
Message 7 of 10
(4,955 Views)

I agree.  Can you recommend a knowledge base artical, etc. where I can begin to educate myself on the ins and outs of ActiveX?

0 Kudos
Message 8 of 10
(4,912 Views)

Well, I can tell you that the last time I did serious work with ActiveX/Excel for LabVIEW, I was running Windows XP, which gave me access to the Office 2007 ActiveX Help, where there was pretty good explanation of the calls and uses of ActiveX.  Since then, I think Microsoft has (maybe "abandoned" is too strong a word) "de-emphasized" ActiveX -- I had a lot of trouble getting similar Help screens for Office 2010 on Windows 7 (indeed, I kept my XP machine around until a few months ago, and turned it on if I needed ActiveX Help).

 

There is, still, the Web ...  However, this is not a particularly "user-friendly" API.

 

Bob Schor

0 Kudos
Message 9 of 10
(4,898 Views)

What I think you (and others, myself included) are trying to do is to use LabVIEW to "work with" Excel, to be able to read, modify, and write Excel WorkBooks.  However, I think the model that NI has for the Report Generation Toolkit is summed up in the name of the Toolkit, "Report Generation", i.e. a "Write-Only" application, where you (necessarily) develop and decide all of the design criteria yourself.  Note that there is scant provision for reading an Excel Workbook (which works perfectly well, by the way) -- they only speak in terms of a "Template", which I think they intend as a "Boiler Plate" with pre-defined Sheets and possibly Headings.

 

I've filed an Idea for NI to add "Get" Format and Graph functions to complement their "Set" functions (and provide the information you want).  If you like this Idea, vote for it here.

 

Bob Schor

0 Kudos
Message 10 of 10
(4,895 Views)