LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Append to excel file (not csv)

Solved!
Go to solution

Hey, I'm having an issue with append table to the excel vi.

I know that it looks wired, but I need it that way (this is the only part from big project I want to replace)

Now I have CSV file, but I need it to be excel file from the start.

As for the loop, I dont know the num of iterations (it will be in while loop later)

Am I right that I want to pass the last row from the loop/while to the next append? If so, so what is the logic in the vi itself after all? APPEND TABLE TO THE REPORT.

 

Please advice, I'm sure I made something wrong, but I cannot figure it out.

 

alexela_0-1658354387991.png

 

 

 

Thanks a lot!!!

0 Kudos
Message 1 of 17
(1,878 Views)

Just looking at the picture, there are many things just plain wrong and I recommend to do a few tutorians to get more familiar with array operations.

 

For example, in the first loop, you are growing an array in a shift register, but writing the intermediary array with each iteration, meaning that the first line will occur four times in the file. Seems redundant.

 

Also, the correct function to append a row is "built array", not "insert into array"

 

Sorry, it not clear at all what you are actually trying to do.

 


@alexela wrote:

I know that it looks wired, ...


Yes, LabVIEW code better looks "wired" 😄

Message 2 of 17
(1,847 Views)

Thank you for your answer, but it's irrelevant to my question.

I wasnt asking about arrays, I know this is a mess, but I'm asking about the append function. 

 

Im trying to append a new row/table to excel file (not csv)I have two blocks first will add some data, after some more stages another will add to the same file. 

 

Wired code, wants about the labview, I already got use to it. But mine code.

 

Is this more clear now? Can you help me with this? I will definitely loop for more tutorials on arrays, promise you. 

 

0 Kudos
Message 3 of 17
(1,828 Views)
Solution
Accepted by topic author alexela

Do you mean you want to append a table below the previous table?

 

If so, you can use the function Excel Get Last Row. It gets the coordinates of the last row in your Excel as MS Office parameters out. You can then give that output to Append Table to Report as the MS Office parameters input.

 

Edit: I'm not really sure how to provide a clear example of it, I just use it before doing an Append Table to Report in order to specify the starting cell for the table. I'm using LabVIEW 2015 so the VI may or may not change depending on the version, I don't really know.

Andeagon_0-1658408735051.png

I threw in the report and error in/out just to show that there could be steps before and after. If you are not sure what the VI does, Ctrl+H opens the context help. When overing your mouse on a VI or any object, it shows a short explanation in the context help window. Clicking on Detailed help provides you with some insight as to what every input and output  of the VI is used for. 

Andeagon - LabVIEW 2015
0 Kudos
Message 4 of 17
(1,817 Views)

Do you have any examples?

I found this vi, but didnt tried it yet.

Will do so today.

 

Thanks.

 

0 Kudos
Message 5 of 17
(1,813 Views)

@alexela wrote:

Am I right that I want to pass the last row from the loop/while to the next append? If so, so what is the logic in the vi itself after all? APPEND TABLE TO THE REPORT.

 

Please advice, I'm sure I made something wrong, but I cannot figure it out.

 


Look, this sentence really makes no sense. You are already appending data. What else do you want?

 

If you have working code that uses a CSV file, please show us that so we can see what you expect. in the end.

0 Kudos
Message 6 of 17
(1,801 Views)

Again:

I have two blocks, each block inserts row or table into EXCEL FILE (NOT CSV)

First block is working, I can add a row, but the second is not. 

Append table to report not appending, but putting the data at the beginning. 

 

Lets make it simple: 

I want to add 5 rows at the start (in while loop with condition), and another block (after processing the data, not straight after first one) will append couple more rows. 

I thought I can use append table, but I'm doing something wrong.

Is it simple enough? 

 

Doesn't matter what I have now, please leave it. 

0 Kudos
Message 7 of 17
(1,796 Views)

Hi alexela,

 


@alexela wrote:

Again:

I have two blocks, each block inserts row or table into EXCEL FILE (NOT CSV)


Instead of repeating the question you should read the answers already given (more carefully)!

 

The AppendTableToReport has some more inputs. One of them can be used to define a position within the Excel sheet - as has been shown before!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 17
(1,786 Views)

Finally some one who can simply answer!!!

Thanks a lot!!!!

Appreciate 

0 Kudos
Message 9 of 17
(1,782 Views)

Hello, Alexela.  About eight years ago, I posted here on the Forums a "Revised Generate Excel Report" example.  If you type "Revised Generate" on the search bar at the top of the Forum, you should find it.  It shows positioning tables, graphs, etc. in Excel, and I think should be fairly clear.  I tested this routine recently, and it still works (though a few of the Report Generation Toolkit functions have new names ...).

 

Bob Schor

0 Kudos
Message 10 of 17
(1,779 Views)