From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write array to spreadsheet string

Solved!
Go to solution

 


@differential equation wrote:

I am also facing this similar problem and the main problem being faced is with giving path to the spreadsheet.


 

What kind of problems are you having with the path?

If you don't wire the path, you get a file dialog. However, I recommend using an explicit file dialog primitive, this way you can handle the case where the user cancels it.

If you want to programmatically generate a path, use path diagram constants, strip path/build path tools, and plain string operations on the filename.

0 Kudos
Message 11 of 19
(1,534 Views)

Hello people

 

I am fairly new to labview and I have been going through the posts about wrting to spreadsheet. I manage to follow the example of how to add string to a spreadsheet and succeeded. However, when I try to save again it does not add a new row of data but instead it replaces the existing data.

 

T1   T2  T3  T4  ............

2      4     6    8    ..........    <====     this row get replaced when saving.

 

Please see attached of how i did it and would appreciate any help or hint. Thanks

0 Kudos
Message 12 of 19
(1,523 Views)

If you use a latch action button, you would not need to reset the button with a local variable.

 

Of course the second time the code executes, you rewrite the header from the beginning (the first primitive does not have "append=true") and then append one line. You never get past one line of data. You should write the header once outside the loop (or on first run) then keep appending the data only.

 

It would be much more helpful if you could attach the actual VI instead on an image.

Message 13 of 19
(1,520 Views)

Hi Knight of Ni

 

Thank you very much for your help. I did as you suggested and it works now! Thanks for the tip regarding the latch button. No need to use a local variable as i did before.

 

 

0 Kudos
Message 14 of 19
(1,509 Views)

Dear sir,

 

I have attached the VI file. I would like to get your suggestion for correcting it. I am not able to go further on with this.

 

Regards

 

Shashi

0 Kudos
Message 15 of 19
(1,486 Views)

It would help if you could tell what the problem is.

 

 

  • Well, wire the path to the write node.
  • Wire a "!=0" to the iteration terminal and its output to the "append?" input. If you want to start fresh with every run of the program.
  • Place a small wait inside the while loop. You don't want to append a million lines per second.

 

 

Also be aware that even though you give it a "*.xlsx" filename, it will not be an excel file, but a simple ascii table. Some programmers still give it an xlsx extension, causing it to open with excel when double-clicked in the file manager. Excel is typically smart enough to silently convert it so it might look like nothing is wrong. For the same reason, you would not be able to append data to an existing proper excel file. Once it is saved as excel file, the file structure is quite different. If you need to interact with a true existing excel file, you would need to do things quite differently.

 

Can you clarify what you actually want to do?

0 Kudos
Message 16 of 19
(1,485 Views)

Dear sir,

 

I have tried to sort out the issues which you have mentioned in your previous reply but still the problem exists.

 

1. The file path has been given by creating a constant on the new file path which is the name of a new file in which i would like to data to be stored.

 

to Whenever i am trying to run this it opens up a dialog for me to browse the file and enter but i am still not able to detect which file to be read. If you have some example file then it might help me or if some link for some tutorial then it can be the other option.

 

I am attaching the file again. Kindly send in your suggestion.

 

Regards

 

Shashi

0 Kudos
Message 17 of 19
(1,475 Views)

 

  • Why is is there no wire between the path constant and the "file path" input of "write to spreadsheet file"?
  • Maybe you have a spelling error in the path? (e.g. could id be "...\projects\..." instead of "...\prjects\...")
(You can right-click the path constant and select "browse for path" and select an existing file to make sure the path is valid)

 

0 Kudos
Message 18 of 19
(1,463 Views)

 

  • Also, what's the point of "Insert into array"? Makes no sense.

 

0 Kudos
Message 19 of 19
(1,449 Views)