07-03-2023 05:14 AM
My VI collects accelerometer data and saves it as '.xlsx' files. I have updated my code and need to reprocess the data I have collected. My initial step was to use the report generation tool kit to load in each individual file, reprocess the data with the updated code and save in a new location. This is tedious and time consuming when reprocessing as I have over 500 files.
Is it possible to load a folder of excel files into LabVIEW which will iteratively process each file (in a loop) rather than manually entering each file?
Thanks in advance for your help
Solved! Go to Solution.
07-03-2023 06:19 AM
@Max2796 wrote:
Is it possible to load a folder of excel files into LabVIEW which will iteratively process each file (in a loop) rather than manually entering each file?
Of course. Use ListFolder from the File/IO palette to get all files (with specified pattern) and a loop.
07-03-2023 08:39 AM
Brilliant thanks! In terms of saving new data should this be perfromed within the loop?
07-03-2023 09:32 AM
I've copied what you've suggested which successfully reports the file and folder names, however, when I run the VI the data doesn't match the original file. For all rows I get a matrix of zeros which doesnt match the dimensions of my data and the headings arent the same - see attached...
Any suggestions?
07-03-2023 01:35 PM
I managed to solve the previous issue using an alternative method of loading in the data as my data is .xlsx and not .csv
However, I'm still having issues saving the data. I've tried having the write to measurment file inside and outside the for loop but still not able to save the data.
For simplicity I've removed my data processing in the attached VI. So for this example I would be saving the same data I've read into a different folder.
Is write to measurement file the best method for saving data? I've found this method clumsy when saving several parameters as it requires alot of effort to incorporate a new variable in the middle of the series. If you can suggest a better method this would be much appreciated.
07-04-2023 04:01 AM - edited 07-04-2023 04:11 AM
My example was exactly that, an example for proccessing all files from a folder with ReadDelimitedSpreadsheet. But you solved that yourself.
@Max2796 wrote:
Is write to measurement file the best method for saving data? I've found this method clumsy when saving several parameters as it requires alot of effort to incorporate a new variable in the middle of the series. If you can suggest a better method this would be much appreciated.
All Express VIs have a bad reputation, except for TimeElapsed. I would recommend avoiding them. Why not use the report generation toolkit for creating the new file? But I can't help with that because we don't use it.
An other way to store data in Excel is via Activex calls. Here I add a comment to a cell:
Your original data is just a series of numbers, you don't need Excel for that, csv is enough for that and that makes loading and saving much easier - just a thought.
07-04-2023 07:52 AM
07-04-2023 09:09 AM
@alexderjuengere wrote:
you may take a look at https://forums.ni.com/t5/LabVIEW/Darren-s-Occasional-Nugget-09-26-2022/m-p/4257690
As far as I know the VI fom Darren is only to read data from Excel. I don't know if anyone has already created a variant of it for writing.