Open excel file with excelscope in file structure


#1

Hi all,

Situation:
There are multiple excel files. They all contain a unique code in their name:
Eg.: 10001, 10002, 10003,…

The files are stored on a different location
10001 - C:\Users\DelOli\Desktop\Folder\A
10002 - C:\Users\DelOli\Desktop\Folder\B
10003 - C:\Users\DelOli\Desktop\Folder\C

Problem:
There is a variable available that contains the unique code (10001, 10002 and 10003), but there is no data available that maps 10001 to A, 10002 to B and 10003 to C.

For the simplicity of this example I only used 3 folders, but in reality, there are a lot more folders.

Question:
Can I add wildcards to Excelscope?
For instance: C:\Users\DelOli\Desktop*[variable Unique code]


#2

How will be your Variable Unique Code?

One solution(not the best) is if you have folder locations, you can run a for reach loop and check for “File Exists” and then add the file to excel scope.


#3

That’s the whole case: I know that the file is stored somewhere in C:\Users\DelOli\Desktop\Folder\ but I don’t know if it’s stored in A, B, C or …

So I don’t have folder locations available. I want to replace A, B or C by a Wildcard, but I don’t know how.

What do you mean with: "How will be your Variable Unique Code?"
This code is given in an other excel file.


#4

Ok.Regarding wildcard in excel scope, lets wait for others to respond.

As far as I know, you can use the wildcard for searching the file in “Desktop\Folder” subfolders.

strFileName =“10001.xlsx”

Directory.GetFiles(“C:\Users\DelOli\Desktop\Folder”, strFileName, SearchOption.AllDirectories);

https://msdn.microsoft.com/en-us/library/ms143316(v=vs.110).aspx