# Prevent Excel write to recreate the sheet

**URL:** <https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352>\
**Category:** Revit\
**Created:** [December 20, 2016, 6:51am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352 "2016-12-20T06:51:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 20, 2016, 6:51am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/1 "2016-12-20T06:51:12Z")

</div>

Dear all,  
I’ve a create an export to excel in order to have a list of element with related spaces information. Basically with these script I’m able to have the list of spaces related to an MEP element (duct, cable tray, pipe, air terminal, etc.) If the element is crossing more than a space I can have the entire list of spaces.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/4/f410650b2887ecc1c0177f3ce956947a5e8b6265.jpg)  
For a construction company this is very useful and I’m able now to link this information to a planning but, this is not the problem.  
My issue is related with the excel write node. In my Excel I’ve a deep bounces of formulas reading from a sheet which basically contains the list coming from Revit  
 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/5/1547376a92de3194a5658bceb135380ce75eaa58.jpg)  
Every time I update the model and export again, Dynamo deletes the sheet and recreate the sheet again, causing Excel to loose all the references.  
 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/f/0f763c2e8637d684a55ef7d0aa17247df4ea7372.jpg)

The only way is to use the function replace in Excel, to relink all the references to the name of the correct sheet.

On the other side, if I’m choosing to not overwrite the excel from dynamo, I don’t have this error but, I’ve to delete manually the sheet content before exporting, in order to prevent old information to be in the sheet.  
Question: Is there a way to export information to a sheet in overwrite mode, without creating a sheet from scratch?

As always thank for helping!  
Cesare

---

<div class="post-metadata">

**Author:** ![Andrew\_Hannell](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andrew_hannell/32/103315_2.png) [@Andrew\_Hannell](https://forum.dynamobim.com/u/Andrew_Hannell)\
**Post date:** [December 20, 2016, 7:23am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/2 "2016-12-20T07:23:46Z")

</div>

Hi Cesare

I suggest using one spreadsheet (or worksheet) to contain the raw data from Dynamo and link that data into another spreadsheet/worksheet which contains the formulas/charts etc

So you would just write the data with Dynamo then refresh the ‘reporting’ spreadsheet

Andrew

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 20, 2016, 7:25am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/3 "2016-12-20T07:25:13Z")

</div>

Thanks but I tried already this.If two files are both opened you have the same issue. I’ll try with one of them closed but I don’t like this solution 🙂

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 20, 2016, 8:28am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/4 "2016-12-20T08:28:39Z")

</div>

Anyway, even if you try to maintain two separate excel sheets you’ve the same error

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/2/42576c294c1709f52fda4ce4d287ecb3fd789445.jpg)

Basically you’ve an error on the rows that you delete from the model.

---

<div class="post-metadata">

**Author:** ![Andrew\_Hannell](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andrew_hannell/32/103315_2.png) [@Andrew\_Hannell](https://forum.dynamobim.com/u/Andrew_Hannell)\
**Post date:** [December 20, 2016, 10:27am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/5 "2016-12-20T10:27:36Z")

</div>

another option is to use a proper database that knows about about appending data  
Then either use a view in the database, or link into Excel to get the data/charts that you want.

Search on this forum for SQLite- some people seem scared off and try to do everything in Excel, but it is really pretty simple

Andrew

---

<div class="post-metadata">

**Author:** ![NLDaniel](https://avatars.discourse-cdn.com/v4/letter/n/13edae/32.png) [@NLDaniel](https://forum.dynamobim.com/u/NLDaniel)\
**Post date:** [December 21, 2016, 2:12pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/6 "2016-12-21T14:12:08Z")

</div>

@Cesare_Caoduro3  
Try to set the bool for overwrite excel sheet, to false.

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 26, 2016, 11:49am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/7 "2016-12-26T11:49:10Z")

</div>

This is not solving the issue. If you have less rows then you won’t delete previous information

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [December 26, 2016, 2:22pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/8 "2016-12-26T14:22:59Z")

</div>

Hi @Cesare_Caoduro3

Are you saying if you hit Run the previous sheets in your model gets deleted?

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 26, 2016, 2:39pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/9 "2016-12-26T14:39:19Z")

</div>

When you export to Excel you can choose to overwrite or not the worksheet. If you choose yes, in the excel file the worksheet is deleted and recreated runtime and with this, all the references from other worksheets and formulas are lost.  
If you choose “no” the worksheet is not deleted but then you are not sure that all the previous information are cleaned.  
I would like something to “clean” the worksheet before starting to write new data so, the worksheet still exist and all the references are ok.  
Thanks  
Cesare

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [December 26, 2016, 2:51pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/10 "2016-12-26T14:51:12Z")

</div>

> [@Cesare\_Caoduro3](#):
>
> If you choose “no” the worksheet is not deleted but then you are not sure that all the previous information are cleaned.

@Cesare_Caoduro3 how can you say that it is not clean? May be you can create a screencast showing your issue that might help others to get clear understanding.

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 26, 2016, 2:51pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/11 "2016-12-26T14:51:48Z")

</div>

I wrote this node to clear the worksheet before starting to write and it works.  
The only problem now is that at the end of the run, I have two excel opened.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/a/3adbb3cb4eadf67b0474b55ec5acfa1820a4a62a.jpg)

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 26, 2016, 2:53pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/12 "2016-12-26T14:53:58Z")

</div>

It’s easy to prove that. If you export to excel a model with couple of elements and then you update the model removing some element and export again, you will see still the previous elements in the excel. THis is because if you choose to not overwrite, you overwrite only changes. This is good you you add more elements but it is not, if you delete elements.

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [December 26, 2016, 2:57pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/13 "2016-12-26T14:57:13Z")

</div>

@Cesare_Caoduro3 Did you try using Bumble Bee package. You can export values by cell rows and columns.

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [December 26, 2016, 2:58pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/14 "2016-12-26T14:58:16Z")

</div>

Yes, I tried but is not an export issue, just I think in the export node should be included a function to clear the worksheet if this is already in the excel file, or create the worksheet if not.

---

<div class="post-metadata">

**Author:** ![junyaoy](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@junyaoy](https://forum.dynamobim.com/u/junyaoy)\
**Post date:** [April 21, 2017, 4:13am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/15 "2017-04-21T04:13:55Z")

</div>

Hi Cesare

I suffered from the same issue. Not sure if you have already figured out but I found that adding a Boolean Node with True helped it work.

Hopefully you found helpful.

Cheers

---

<div class="post-metadata">

**Author:** ![n.ortiz10](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@n.ortiz10](https://forum.dynamobim.com/u/n.ortiz10)\
**Post date:** [May 17, 2017, 12:52am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/16 "2017-05-17T00:52:02Z")

</div>

Hi, Im having the same issue. You mean adding this node to the custom Write Excel? or the Bumblebee node WirteExcel?

---

<div class="post-metadata">

**Author:** ![junyaoy](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@junyaoy](https://forum.dynamobim.com/u/junyaoy)\
**Post date:** [May 17, 2017, 8:10pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/17 "2017-05-17T20:10:05Z")

</div>

For Excel.Write To File last option, overwrite, you could add Boolean to overwrite the excel instead of updating.

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [May 17, 2017, 9:38pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/18 "2017-05-17T21:38:50Z")

</div>

This is a bug and still isn’t fixed so you should try Bumblebee as a workaround.

> <https://github.com/DynamoDS/Dynamo/issues/6664>

---

<div class="post-metadata">

**Author:** ![apiazzaZ6J42](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@apiazzaZ6J42](https://forum.dynamobim.com/u/apiazzaZ6J42)\
**Post date:** [April 19, 2021, 9:42pm UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/19 "2021-04-19T21:42:38Z")

</div>

I know this was a while ago, but did you ever figure out a better way to do this. I am having the exact same problem you described in your original post.

---

<div class="post-metadata">

**Author:** ![Cesare\_Caoduro3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cesare_caoduro3/32/9974_2.png) [@Cesare\_Caoduro3](https://forum.dynamobim.com/u/Cesare_Caoduro3)\
**Post date:** [April 20, 2021, 3:27am UTC](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352/20 "2021-04-20T03:27:15Z")

</div>

HI Alex,  
to be honest I completely abandoned Excel long time ago, to move to more sustainable and flexible dictionaries using JSON.  
The short answer is I have never looked into it again.  
Good luck!  
Cesare

[Next page](https://forum.dynamobim.com/t/prevent-excel-write-to-recreate-the-sheet/8352.md?page=2)
