Optimizing Purchase Order Automation with Dynamic Column Handling

I am working on developing an automation process to input purchase orders into our system. The main idea is to centralize purchases based on the specific needs of each operation.

Each purchase order is linked to a specific supplier, indicating where the purchase will be delivered and which products are included in the order. I created a database in Excel where I generate the order ID by combining the Supplier ID and Store ID, creating a unique order line. The columns represent the product codes that will be entered into the system.

I had previously created a similar automation, but I ended up doing it in the worst possible way. I couldn’t make it easy to maintain, and I created around 200 variables for each specific column. Additionally, each row could have between 1 to 100 columns with information, so the automation would run endlessly through all 100 predefined columns.

I would appreciate some help in resolving this issue. How can I create a small loop that ignores columns with “null” or “zero” values and continues processing until all relevant columns have been checked, thereby entering the complete purchase order?

Attached is an example of how I did it and what the database looks like.


Example I created, and I know it’s not the best option.

Can you provide a sample Excel file?
Also, can’t this be done via Pivot Table?

First of all, thank you for your interest.

Regarding the pivot table: Is UiPath capable of reading the pivot table? I’m building the base alongside the pivot table, but I’m working on a formatted base for the automation to read. I believe the main difficulty is making the automation understand the looping without having to create hundreds of variables and overloading the activity flow.

The first image you posted resembled a pivot table, but UiPath does not handle well this.
You can loop without having all that variables. If you read the datatable with headers, you can go through the column names to use it, instead of having variables with those names. Can you provide an Excel sample?

“This would be the spreadsheet for filling out the purchase order. From there, what would be your suggestion for modeling the base for automation to read? Would it be possible for the automation to understand the order by store and supplier from this same base? Grouping the products of that order?”


teste.xlsx (10.1 KB)