LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting data from an excel sheet that changes revs constantly

I'm trying to figure out a method for opening and extracting data from an excel sheet that has revision changes quite often.

 

Example:

 

I can extract data from an excel sheet using a filepath using report generation toolkit and lets say the filepath is \common\test\Test_plan_0A_appendix_A.xls

 

If there is an update to this file, it becomes \common\test\Test_plan_0B_appendix_A.xls and Test_plan_0A_appendix_A.xls gets moved to another location.

 

Is there a method that I can use to open the updated file by searching for "appendix_A.xls" or something along those lines?

 

Thank you,

0 Kudos
Message 1 of 4
(2,913 Views)

I'm not sure I understand your question, so let me restate it (and let me know if I get it wrong).

 

You have a location (presumably a folder) that holds Excel files that have a particular naming pattern, say "Test_plan_<ID>_appendix_A.xls", where <ID> is a variable part of the name.  If I understand the phrase "gets moved to another location", then only a single file that fits the pattern "Test_plan_??_appendix_A.xls", where ?? are the DOS search characters meaning "match any single character", will be present.

 

If your question relates to "find the file that matches this pattern", try using the List Folder function found on the Advanced File Functions of the File I/O Palette.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,907 Views)

Thanks Bob.

 

The test plan that I'm extracting data from gets updated periodically

 

Right now it's naming convention is "Test_plan_0A_appendix_A.xls" and it's located in another folder on my computer. So I'm using the location of:

 

"\common\test\Test_plan_0A_appendix_A.xls" to call out the file.

 

when the file gets updated "Test_plan_0A_appendix_A.xls" gets archived in another folder and "Test_plan_0B_appendix_A.xls" gets stored in

 

"\common\test\"

 

I'm trying to make it so that I don't have to update my VI everytime the filename changes by a letter or 2. So, if the List Folder function found on the Advanced File Functions of the File I/O Palette can filter out and search for "Test_plan_??_appendix_A.xls" where ?? doesn't matter.. then that's exactly what I'm looking for.

0 Kudos
Message 3 of 4
(2,891 Views)

Be careful -- ?? requires two characters to match, so _0A_ will match _??_, but _A_ will not.  However (and you should write a little demo to convince yourself that I'm correct -- I can never remember the rules, myself, so I spend 5 minutes writing such a test) _?*_ might work for _0A_ and _A_ (but fail for __, which is probably the result you want in this case).

 

Bob Schor

0 Kudos
Message 4 of 4
(2,885 Views)