Importar archivo txt plano separado por ; a una tabla de excel (Robot Studio)
good morning I want to know how I can do in Pega Robot Studio to import a flat txt file separated by ; to an Excel to convert it into a table and work with the data
good morning I want to know how I can do in Pega Robot Studio to import a flat txt file separated by ; to an Excel to convert it into a table and work with the data
@LuisB647 I apologize for not seeing this earlier. Here is a sample solution. You could of course use a script, but it is relatively simple to do in an automation.
This uses a static method that you need to add to your Toolbox (in 19.1 anyway). This is much simpler in 22.1, however as that release is new, these directions will be for 19.1. To add the static method to your Toolbox;
To read the text file into a table, we first define the lookup table to match the columns in our file. You could skip this if you had a variable number of columns, or if the column order changes frequently, and instead define a new DataTable in your automation and add the columns to it. If that is what you need, let me know, and I can demonstrate that as well.
@LuisB647 I apologize for not seeing this earlier. Here is a sample solution. You could of course use a script, but it is relatively simple to do in an automation.
This uses a static method that you need to add to your Toolbox (in 19.1 anyway). This is much simpler in 22.1, however as that release is new, these directions will be for 19.1. To add the static method to your Toolbox;
To read the text file into a table, we first define the lookup table to match the columns in our file. You could skip this if you had a variable number of columns, or if the column order changes frequently, and instead define a new DataTable in your automation and add the columns to it. If that is what you need, let me know, and I can demonstrate that as well.
The first step we call is the "ReadAllLines" method. This produces an array where each item is a line in your file. If your file contains a header row, we need to skip the first row, so for the example, I am just using a boolean value to indicate the first row. Next, we can use the "Split" method of a StringUtils to split the row into an array. We can pass it the delimiter (you indicated yours is the semi-colon) and get the array by extracting a proxy from the result. We can then use the "Get" method on the array to extract each index value out and pass it to the "AddRecord" method of the lookup table. Once in the LookupTable, you can use the GetTable method to access the underlying DataTable and Import that into your Excel file if you like.
To run the demo; use the RobotInspector to run the ConvertToDataTable automation. It has two parameters, but these are there for example purposes and are not used for the demo. You may leave these empty. Once complete, you can view the LookupTable from the corresponding tab in Robot Inspector.
@ThomasSasnett Buenos días, este escenario me sirvió sin embargo, me podría compartir una imagen de la solución, ya que la automatización no me deja abrirla, seguramente el antivirus la está bloqueando
@LuisB647 Here is a screenshot.
Question
Question
Question Solved
Question Solved
Question Solved
Question
Question
Question
Question Solved
Question Solved
Pega Collaboration Center has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.