I have two kinds of excel files named either A or B in a folder. The task that I’m trying to achieve is that if it is an excel titled A, then check the values of first 4 columns (eg. Age = 20, Name = isnotNothing, Action = Create Code = isnotNothing) , if not I’ll have a log message or trigger an email response.
If it is an excel titled B, then check values of 3 columns (eg. Type = car, Name = isnotNothing, Action = Update)
I’m having problems just differentiating the two types of excel as I have no idea how to read the Excel filename.
My I ask what does the .length at the end does?
And if you have any idea on how to read Excel file names?
What I’m trying to achieve is the bot first read the Excel file names, determines if it is A or B. I’ve tried with file.name.contains"a" but .name doesn’t seem to work in this case.
Then if it is A, it shall do what your first function says it should, and vice versa for B. But if not, it should create a log message.
Sorry if i couldn’t describe it any better. I’ve had no previous programming experience.
Getting the filenames: you may iterate all the files inside the folder/directory.
Example:
Foreach file in directory.GetFiles("C:\myFolder", “*.xls”)
If file.toString.Contains(“xx”) >> todo: check the values of first 4 columns
If file.toString.Contains(“yy”) >> todo: then check values of 3 columns