# Adding header to excel!

**URL:** <https://forum.uipath.com/t/adding-header-to-excel/501080>\
**Category:** StudioX\
**Tags:** question, excel, activities\
**Created:** [December 22, 2022, 7:32am UTC](https://forum.uipath.com/t/adding-header-to-excel/501080 "2022-12-22T07:32:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaled\_emad](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/khaled_emad/32/274207_2.png) [@khaled\_emad](https://forum.uipath.com/u/khaled_emad)\
**Post date:** [December 22, 2022, 7:32am UTC](https://forum.uipath.com/t/adding-header-to-excel/501080/1 "2022-12-22T07:32:30Z")

</div>

How can I add headers to the excel sheet I created from a Datatable. and avoid the loop to add it between every row?  
So what i am trying to do is to check if the excel sheet has empty rows to write range if no to append

thanks

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [December 22, 2022, 7:35am UTC](https://forum.uipath.com/t/adding-header-to-excel/501080/2 "2022-12-22T07:35:05Z")

</div>

@khaled_emad

You can use add header property to add the headers

If you are adding it multiple times…then first time use write range wirh add headers and from  
Next time you can either use append range or write range without add headers and passing the cell value appropriately

Cheers

---

<div class="post-metadata">

**Author:** ![arivu96](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@arivu96](https://forum.uipath.com/u/arivu96)\
**Post date:** [December 22, 2022, 7:35am UTC](https://forum.uipath.com/t/adding-header-to-excel/501080/3 "2022-12-22T07:35:26Z")

</div>

Hi @khaled_emad ,  
If you have the datatable directly use write range activity to write all headers in excel.

Regards,  
Arivu

---

<div class="post-metadata">

**Author:** ![Gokul001](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gokul001/32/462734_2.png) [@Gokul001](https://forum.uipath.com/u/Gokul001)\
**Post date:** [December 22, 2022, 7:38am UTC](https://forum.uipath.com/t/adding-header-to-excel/501080/4 "2022-12-22T07:38:18Z")

</div>

HI @khaled_emad

If the have the data in the Data table and check the file is exist or not.

You can use If activity to check the file exist

```auto
File.Exists("C:\Users\Dell\Documents\UiPath\Test\BuildDt.xlsx")

```

![image](https://global.discourse-cdn.com/uipath/original/4X/5/6/d/56db60ac5740c9f78ccd9f0cefc72b1b147ceaa2.png)

Regards  
Gokul
