Excel Read: Read keywords from column 1 and find simultaneous match from column 2

My bot is reading 1 pdf file at a time and performing multiple operations.
After performing all the operations with the text read from pdf I want to rename the pdf files and store them in certain location, so for renaming there is condition that for eg:if the pdf text contains “X” rename it as"Type1" if “B” then rename as “Type2”.
I have stored all the keywords (which can come in the entire set of pdf files which I am processing) in 1st column of excel and also the the name which it has to be renamed to in the simultaneous cell in next column.
Now, I want the bot to go and check the first column from top and check if the if the first keyword exists in the pdf text then rename it with the simultaneous value in next column, if not found then move to next row of keywords.

Any suggestions will be very helpful.

Hi @Faraz_Subhani,
If you’re fetching those PDF files from a folder and reading it, then you can use path.getfilename() to get the exact name of the the file. You can then use string.contains() to check if the file name contains that particular keyword (looping you DataTable i.e., your excel sheet). If there is a match send hotkey as ctrl+alt+s to open “save as” menu then, give the path and the name that has to be renamed using a type text activity.

Let me know if you have any queries.

Thanks and regards,

Hi @Ananthu
I have completed all the process such as extracting and getting file names, only problem I have is with iterating through excel.
eg: I want the bot to iterate through 1st column of excel which contains the keywords, if the keyword is found in the text extracted from pdf then find the simultaneous value in the next column beside the keyword, I am not able to attain this part.

Hi @Faraz_Subhani,
Make use of the workflow that I have attached. Let me know if you have any queries.
iteratingExcel.xaml (9.8 KB)

Thanks and regards,

Great! This logic will work for me, Thank You very much @Ananthu, you are always of great help.

1 Like

Welcome :slight_smile: