I have a problem how to define specific position for paste information.
Idea:
This process will be based on REF and I have in my mind dispatcher to recognize what is this week monday date(you can find same date in collum B in excel - attached picture). Store it in a queue. After that performer take this information and base on this find correct row(same date in collum B) in excel file(attached picture).
Do you have an idea how to store actual week´s monday date ( this week is calendar week 35 that mean that this week monday was 30.8.2021) in to queue ? I know how to store via “Reference/collection” of “Add Queue Item” but how to recognize actual week´s monday date is the question.
Thank you for your ideas
Here you can see the picture of file what am workin with
as far as I understand, you need to find the date of Monday in current week, right?
If yes, then you can try with
MondayDate = DateTime.Now.AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek .Monday)) mod 7).Date.ToString(“dd.MM.yyyy”)
where MondayDate is of type string.
I still have a problem I am able to describe what is a date of this week monday via: “DateTime.Now.AddDays(-1(7 + (DateTime.Now.DayOfWeek - DayOfWeek .Monday)) mod 7).Date.ToString(“yyyy-MM-dd”)*” but via this I am not able to find specific date in excel file where is a date in same format mentioned. I think the problem is in “variable type” I asign this monday like a string but in excel file is system.datetime format. Do you know how to switch from string to datetime?
Conversion from String to DateTime can be done using: Datetime.ParseExact(MondayDate,“yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture)
Also, after extracting the date from the excel file I advice you to trim the value (the variable of type string), as this might be the reason why you don’t find specific date in excel file similar to the Monday’s date.
In the example I have sent you the value from the excel is date format
after I run the project that I have sent you, this is the result:
In the project you can see the excel that I am using.
Check if the format in the excel file is the same as the format of the value that you have when getting the Monday’s date
Okay, try to change the ModayDate format like DateTime.Now.AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek .Monday)) mod 7).Date.ToString(“MM/dd/yyyy”)