I am just trying to do simple automation. trying to copy all the rows value of excel sheet 1 into particular column of excel sheet 2. I have used excel application scope and then read range and again another excel application. Finally I have tried to write the value using Write Range but I keep getting this effort. My sheetname is AnotherCell in the second excel sheet and I am trying to write/paste value from A3(third row of first column).
Hi @Samraat_Maharjan1 ,
Could you please provide screenshot of what you are doing and exact exception details what you got to narrow down what issue you are facing.
So far i understood you want to copy one column from one excel to another, right?
possible reasons of this error and number 2 is more close:
- Invalid range: The range provided in the “Write Range” activity may be invalid or incorrect. Make sure you specify a valid range that includes the target cell where you want to write the data. For example, if you want to write to cell A1, specify the range as “A1” or “A1:A1” if you only want to write a single cell.
- File in use: The Excel file you are trying to write to might be open or locked by another process, preventing UiPath from accessing and modifying it. Ensure that the file is not open in any other application and that it is not being used by another process.
before write range kill all excel instances and try to write after that
I actually wanted to write from A3 to all the down depending on number of rows I had in the previous sheet 1.
@Samraat_Maharjan1 In write range can you open “Range” block
What is “Another Cell”
Just put “A3”
Are you passing the correct cell reference?
I see some text in double quotes?
what is this
just put “A3”
When you are mentioning the sheet already, Just put A3, because you are already using excel scope to write it on.
even A3 didn’t work. I got same error. I basically wanted to to paste valeue from third row of A column
Can you share the error details? Is it same as earlier.
Hope you have put A3 in double quotes?
Can you kill all instances of excel.exe from task manager and then try again
When you read the excel, are you getting correct value in your datatable? Just check in locals panel
Else, Please share your xaml, let me have a look.
Cant really say whats wrong at the moment.
Can you another excel application scope out of the previous one.
Main (2).xaml (14.7 KB)
Here you go its working now.
To copy all the rows’ values from Sheet1 in Excel to a particular column in Sheet2 of another Excel file, you can follow these steps:
- Use the Excel Application Scope activity to specify the Excel file you want to read from.
- Within the Excel Application Scope, use the Read Range activity to read the data from Sheet1 into a DataTable variable.
- Use another Excel Application Scope activity to specify the Excel file you want to write to (the second file).
- Within the second Excel Application Scope, use the Write Range activity to write the data to Sheet2.
- In the Write Range activity, set the Range property to “AnotherCell!A3” to indicate that you want to start writing from the third row of the first column.
- Set the Value property to the DataTable variable obtained from the Read Range activity.
- Make sure to check the “AddHeaders” option if you want to include headers in the written range.
@prateek.mehandiratta9 noticed you have used filter Data Table. Can you please explain me how does it help us in this process? Also, It didn’t work second time when I changed the file.
I used i t because it was picking up empty rows while reading since you are reading the entire column, just check if thats the case with your data too, otherwise you can remove that if not needed.