You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see my input string contains year values.
My replacement pattern is like below
FY1920 should be replaced as FY2021
FY2021 should be replaced as FY2122
FY2122 should be replaced as FY2223
FY19 should be replaced as FY20
FY20 should be replaced as FY21
FY21 should be replaced as FY22
But the problem is Replace method is not looking for exact full match
How can I tell the xlwings to replace only when the text contains only the search string fully (and is not followed by any other string/number).
ex: When text contains only FY20, it should be replaced as FY21. It should not be replaced when part of the text contains FY20 (in cases like FY2021)
Therefore, you can see, my actual output is incorrectly replaced
How to do we instruct Xlwings to replace keywords based on condition?
For ex: In a text, it could be sometimes All FY20,FY21. Here the replacement should happen only when my search string is FY20,FY21. else it should not replace for individual keywords like (FY20 or FY21 etc)
The text was updated successfully, but these errors were encountered:
@fzumstein - Thanks. you are right. but just realized the cell was shrinked and had a text within it. Apologies. I didn't realize that earlier.
something like below. In this case would LookAt help? may be that's why it didn't work for me. Can it take regex etc?
Versions of xlwings, Excel and Python (e.g. 0.24,Excel 2019, Python 3.7)
This is related to this issue 1945
I have an excel sheet like below and also attached the file
dummy.xlsx
As you can see my input string contains year values.
My replacement pattern is like below
FY1920 should be replaced as FY2021
FY2021 should be replaced as FY2122
FY2122 should be replaced as FY2223
FY19 should be replaced as FY20
FY20 should be replaced as FY21
FY21 should be replaced as FY22
But the problem is
Replace
method is not looking for exact full matchHow can I tell the xlwings to replace only when the text contains only the search string fully (and is not followed by any other string/number).
ex: When text contains only FY20, it should be replaced as FY21. It should not be replaced when part of the text contains FY20 (in cases like FY2021)
Therefore, you can see, my actual output is incorrectly replaced
This is the code that I tried
How to do we instruct Xlwings to replace keywords based on condition?
For ex: In a text, it could be sometimes
All FY20,FY21
. Here the replacement should happen only when my search string isFY20,FY21
. else it should not replace for individual keywords like (FY20 or FY21 etc)The text was updated successfully, but these errors were encountered: