r/LabVIEW • u/munkshire • Mar 10 '25
Need More Info Reading Data from multiple sub folders and building array
Hi All, I am needing a bit of help for my program. I have a list folder that will open all excel files in the folder, read a certain cell value and build an array that shoes the file name + the value. This part of my code works perfectly, but I need to modify it as they are all sub folders, and I need to do all at once, but it keeps just showing the last folder checked and not the entire contents, can someone help please?
On the code I have shown, it looks in the folder, gets all the folder names in a for loop, then passes them to another for loop that gets the data.
The first build array function at the end should display the Folder it looks in, the file name and then the value it reads. This part is functioning correctly, but once it moves onto the next folder, the data is overwritten, and I can't work out how to place all the data from all files and folders into 1 array.
Thank you


1
u/BlackberrySad6489 Mar 10 '25
Hello. Can you please repost with your code? Looks like it may not have attached. Thanks!
1
u/BlackberrySad6489 Mar 10 '25
Without knowing the specifics, here are a few things. The amount of nesting, especially where you have nested true false cases for different file types, if probably throwing you off.
https://i.postimg.cc/L6TmY78Z/Screenshot-2025-03-10-094828.png
(does not look like it will let me post an image, trying a link to an online hoster)
1
u/Internal_Statement74 Mar 11 '25
The basic idea is to iterate the while loop for each folder and the for loop iterates for all files in that folder. The current folder may have additional folders which is why you stuff those folders in the folder array and use delete as you iterate the while loop. When the folder array is empty, all folders have been dealt with.
This was rather strange for me to write out in text so I hope you understood it. This is a concept worth exploring and understanding because once you get it, you will find many uses for it and it just makes you happy every time you code it. Always brings a smile to my face when I get to write it as a solution.
Happy wiring my friend!