I would really appreciate any help in building the following workflow.
I have two files of data:
A CSV file that contains about 250 rows of transactions. Each row details 10 columns of common data about each of the transactions. Included is the account number which is populated and the customer code which is an empty field.
I also have a separate Excel workbook that contains two columns of data that act as a ‘mapping table’ between an account number and the corresponding customer code.
I would like to achieve the following:
I would like to select the account number for each of the 250 transactions on the CSV file and look up whether it exists in the excel mapping table.
• If it does exist, I would like to copy the corresponding customer code from the mapping table and update it into the corresponding empty column cell of the transaction in the CSV file. Also, if the customer code does get updated, then I would like to update another field in the corresponding column cell with a static data value of “closed”.
• If the account number does not exist in the mapping table then no action should be taken for that transaction, and the next transaction should be interrogated in the same fashion.
This should be repeated for each row up to and including the last transaction in the CSV file.
Many thanks in anticipation of your kind assistance.
@TerryD, Hi Below is the procedure and it should work. This is not optimal but sufficient to solve your problem. I was able to do it so you will be able to code with below clues.
1.Read CSV (datatable - data265)
2.Read excel(datatable - Book1table)
3.For each row in data265
4…For each row in Book1table(this is not optimal… but works!)
4.1…IF Account(data265) = Account(Book1table)
4.2…update data265 with accountCode from Book1table
4.3…write Cell( Book1). status column as “Closed”
4.4Loop through all Book1Table rows(like I said it is not optimal but works)
5.Loop through all rows in data265
6.WriteCSV to finalCSV from data265
Thank you @viswanarahari that very helpful.
When you say that you tried it and it worked - do you have a copy of the process flow that you would be able to share as an xaml file?
Many thanks,
T
Hi @TerryD, Not sure how you got ‘Untitled.csv’ ? It is not in my files I sent to you.
Book1 - can be your starting excel. Look in that and you can see 'Status’ is ‘closed’ for two accounts. Before you run my xaml, please replace‘closed’ with space and save the worksheet and close the excel program.
csv265.txt - is your starting comma separated values txt.
finalCsv.txt - is your final text. If you want later rename it to finalCsv.csv.
So where there is a match for ‘Account’ (in the mapping table ‘Book1’) we should then update the Code with that of the code from the mapping table 'Book1". In this instance also update ‘status’ with ‘Closed’
If there is no match to ‘Account’ (from Book1), then no action for that row and move onto the next row.
Additionally, the format of the initial ‘csv265’ file is excel workbook.csv rather than .txt - what is the easiest way to encompass this into the workflow?
Hi @viswanarahari,
Thank you very much for your help with this. It was really useful and the process now works as planned. Great job.
Best regards,
Terry.
I have an excel file with Columns Name and ID.I got ID from a web page and stored into a variable.
Now the requirement is to open the excel and lookup for the ID got from the Web page and need to pull the corresponding name in the next column.Can someone guide me how to write the code. @ClaytonM@arivu96