Write content in Excel and then “copy/split” it onto spreadsheets

Hello, I would like to create a process in UiPath Studio that allows me to enter my travel destinations into an Excel spreadsheet. I have successfully completed the process up to this point. I use “Input Dialog” to ask myself three questions. 1. Where were you? 2. What did you do there? and 3. How long were you there?

I have managed to get the Excel spreadsheet read, check whether there is already something in the columns, and then insert another row with the information from the three questions.

So far, so good. Now for my question.

The information is currently all inserted into Table1. This means that all the travel destinations from the first query are mixed together there. I now want the bot to recognize which destination was selected and then copy the row to the other spreadsheets as well.
! Important: everything should take place within the same Excel file and only be copied/distributed to different spreadsheets. !

E.g.

  1. Where were you? Paris
  2. What did you do there? Sightseeing
  3. How long were you there? 5 days

The bot should then copy this row to the “Paris” spreadsheet so that Table 1 contains all entries ever made and the Paris spreadsheet contains all entries collected in response to the first question with Paris.

Since I am completely new to this topic, I would appreciate a very detailed description of a solution, preferably a click-by-click guide or a ready-made process in Studio so that I can follow it step by step.

Thank you in advance!

Hi @l2path1400

You can write all entries to the main sheet using Write Range or Append Range. After that, read the value from “Where were you?” and use an If activity to check whether a sheet with that name exists using Workbook Get Workbook Sheets. If the sheet exists, write or append the same row to that sheet. If it does not exist, use Add Sheet and then write the row.
The row data can be stored in a DataTable with Build Data Table and then appended to the correct sheet. This allows Table1 to keep all entries and each destination sheet to receive only the matching rows.

If helpful, mark as solution. Happy automation with UiPath

Hi @l2path1400

You can do this entirely in the same Excel file by adding a small decision step after you write to Table1.

  • Always write the entered data first into the main sheet (Table1).
  • Then, based on the answer to “Where were you?”, write the same row into the corresponding destination sheet.
  1. Use Input Dialogs to collect:

    • destination (string)
    • activity (string)
    • duration (string)
  2. Use Excel Application Scope (same Excel file for everything).

  3. Read Table1 into a DataTable (optional if you already append directly).

  4. Append the new row to Table1 (using Write Range or Add Data Row logic).

  5. Build a new DataRow in memory:

    • Column1 = destination
    • Column2 = activity
    • Column3 = duration
  6. Use an If or Switch activity:

    • If destination = “Paris” → targetSheet = “Paris”
    • If destination = “London” → targetSheet = “London”
    • etc.
      (or directly use the destination variable as the sheet name, if sheets are named exactly the same)
  7. Use Write Range or Append Range to write that single row into the destination sheet.


This is basically what it currently looks like…

Hi @l2path1400

Welcome to the community!

I recommend some things,
Please don’t use nested do while loops , use only one do while if needed you can go with add data row after this use write to excel once.
Hope this works!

@l2path1400

As you are new and trying to learn

I would suggest go with academy.uipath.com to learn more

coming to your case

then only thing you need to do is first get all the unique places from your main sheet. dt.AsEnumerable.Select(function(x) x("Place").ToString).Distinct - here dt is the datatble with main sheet data..then this gives a list of unique places

Now loop on this unique list and inside it use filter datatable on dt to filter with currentitem and get all the rows belonging to that place..which you then need to write it to respective sheet

cheers

Thanks for all the tips. Unfortunately, I’m still stuck. I’m already completing the workshops in the Academy. This is a project for me to see what I can already do. Is there any chance someone could build the process in Studio and show me? Then I can recreate it and maybe understand it better.

1 Like