# Error occurs while using read range activity

**URL:** <https://forum.uipath.com/t/error-occurs-while-using-read-range-activity/188897>\
**Category:** Help\
**Tags:** datatable, question, activities, excel, system\
**Created:** [January 28, 2020, 10:02am UTC](https://forum.uipath.com/t/error-occurs-while-using-read-range-activity/188897 "2020-01-28T10:02:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rifnanahas](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rifnanahas/32/180177_2.png) [@rifnanahas](https://forum.uipath.com/u/rifnanahas)\
**Post date:** [January 28, 2020, 10:02am UTC](https://forum.uipath.com/t/error-occurs-while-using-read-range-activity/188897/1 "2020-01-28T10:02:40Z")

</div>

I have a datatable (DT) with name and department as column names. From that data table I want to filter each department with student name and write into a new sheet in excel. i.e I created an excel file and create new sheet for each department and write the name to those who belong to that department.  
for this to perform I do these steps

1. for each activity for DT  
2)assign depart=row.item(0).tostring  
3)Filter datatable activity used to get a new datatable(FilterDT) with condition as department column name = depart  
4)then inside for each activity of DT, I use write range activity to write FilterDT to excel with sheet name as variable depart

now when i perform this I got an error like " Write Range: Failed setting the current sheet to: in workbook: C:\Users\rifnan\Downloads\List.xlsx. Original error message: Exception from HRESULT: 0x800A03EC"

Can anyone please provide me with correct answer

---

<div class="post-metadata">

**Author:** ![Blesslin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/blesslin/32/181697_2.png) [@Blesslin](https://forum.uipath.com/u/Blesslin)\
**Post date:** [January 29, 2020, 9:05am UTC](https://forum.uipath.com/t/error-occurs-while-using-read-range-activity/188897/2 "2020-01-29T09:05:36Z")

</div>

@rifnanahas please find the screenshots for your query.  
please let me know if it works.

 ![image](https://global.discourse-cdn.com/uipath/original/3X/8/8/8826ee04838d3cd33d7a1d977ab628a6a0002307.png)

---

<div class="post-metadata">

**Author:** ![Blesslin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/blesslin/32/181697_2.png) [@Blesslin](https://forum.uipath.com/u/Blesslin)\
**Post date:** [January 29, 2020, 9:06am UTC](https://forum.uipath.com/t/error-occurs-while-using-read-range-activity/188897/3 "2020-01-29T09:06:20Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/d/4/d459b1abe7d73e3a7a73201e22181d1c9667f1cd.png)
