To copy data from an Excel file and paste it into separate Word documents in UiPath, you can follow these steps:
Use the Read Range activity to read the data from the Excel file into a data table. Specify the path to the Excel file and the range of cells containing the data in the Read Range activity’s properties.
Use a For Each loop to iterate through the rows of the data table.
Inside the For Each loop, use the Open Word Application activity to open a new instance of Microsoft Word.
Use the Type Into activity to type the data from the current row of the data table into the Word document.
Use the Save As activity to save the Word document with a unique file name.
Use the Close Word Document activity to close the Word document.
Use the Close Word Application activity to close the instance of Microsoft Word that was opened in step 3.
Here is an example of how this could be implemented in UiPath:
Copy code
ReadRange excelData = new ReadRange();
excelData.WorkbookPath = "C:\\data.xlsx";
excelData.Range = "A1:B5";
ForEachRow row in excelData.OutputDataTable
{
OpenWordApplication wordApp = new OpenWordApplication();
wordApp.Execute();
TypeInto typeData = new TypeInto();
typeData.Text = row("Column1").ToString() + " " + row("Column2").ToString();
SaveAs saveDoc = new SaveAs();
saveDoc.FileName = "C:\\doc" + row.Index + ".docx";
CloseWordDocument closeDoc = new CloseWord