# Fail to load library at Excel.Workbooks.Open()

**URL:** <https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225>\
**Category:** Developers\
**Tags:** zerotouch\
**Created:** [November 4, 2017, 1:01am UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225 "2017-11-04T01:01:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [November 4, 2017, 1:01am UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/1 "2017-11-04T01:01:43Z")

</div>

Using C# to write a custom node that writes date to specific cells on a Excel sheet. The code works fine as windows application. but got “Fail to load library” error while adding the dll into Dynamo. I’ve found the the first line that cause the error is at “excelApp.Workbooks.Open()”. Is there any steps that I missing in order to make this work? Thanks?

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.DesignScript.Runtime;
using Autodesk.DesignScript.Interfaces;
using Microsoft.Office.Interop.Excel

public class Node
{
    public static void DynWriteToXl(double a, double b)
    {
        string fileName = "C:\\Schedule.xlsx";
            
        Microsoft.Office.Interop.Excel.Application excelApp;
        Microsoft.Office.Interop.Excel._Workbook wBook;
        Microsoft.Office.Interop.Excel._Worksheet wSheet;
        object misValue = System.Reflection.Missing.Value;

        excelApp = new Microsoft.Office.Interop.Excel.Application();
        //open
        wBook = excelApp.Workbooks.Open(fileName, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);//This is the problem start
        wSheet = (Microsoft.Office.Interop.Excel.Worksheet)wBook.Worksheets.get_Item(1);

        ////write
        double col = 2;
        wSheet.Cells[6, col] = a;
        wSheet.Cells[7, col] = b;

        try
        {
        //save
        excelApp.DisplayAlerts = false;
        wBook.SaveAs(fileName, misValue, misValue, misValue, misValue, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, misValue, misValue, misValue, misValue, misValue);
        wBook.Close(true, fileName, misValue);// close the worksheet
        }
        finally
        {
            if (excelApp != null)
            {
                excelApp.Quit(); // close the excel application
            }
        }
    }

```

}

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [November 9, 2017, 12:38am UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/2 "2017-11-09T00:38:33Z")

</div>

any one? Please…😞

---

<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:** [November 9, 2017, 7:16am UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/3 "2017-11-09T07:16:19Z")

</div>

Hi @glenncai

Did you try @Konrad_K_Sobon 's nodes from archi-lab package?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/1/014c2ecaca3d4f13275a06eeedc692edb37ef105.png)

---

<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:** [November 9, 2017, 7:22am UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/4 "2017-11-09T07:22:29Z")

</div>

> [@glenncai](#):
>
> I’ve found the the first line that cause the error

What does the error says?

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [November 9, 2017, 8:10am UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/5 "2017-11-09T08:10:37Z")

</div>

> [@glenncai](#):
>
> “Fail to load library” error

Did you check if there is no suitable solution mentioned in this thread?

> [@Sharing 'Zero Touch Nodes' on other computers](https://forum.dynamobim.com/t/sharing-zero-touch-nodes-on-other-computers/12474/8):
>
> So try creating a package (make it an internal package if you are not ready to share). The import functionality tends to misbehave sometimes. See if that help.

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [November 9, 2017, 1:50pm UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/6 "2017-11-09T13:50:18Z")

</div>

@glenncai do you have excel installed?

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [November 9, 2017, 6:00pm UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/7 "2017-11-09T18:00:21Z")

</div>

Hi Kulkul  
There is no error while compile my code in Visual Studio.  
This is the one of line I believe that cause “Fail to load library” message in Dynamo, because if I stop compile my code before the line: excelApp.Workbooks.Open() the dll will load successfully.

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [November 9, 2017, 6:00pm UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/8 "2017-11-09T18:00:56Z")

</div>

Hi John  
Yes I do, Excel 2013

---

<div class="post-metadata">

**Author:** ![Przemyslaw\_Krauze](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/przemyslaw_krauze/32/108014_2.png) [@Przemyslaw\_Krauze](https://forum.dynamobim.com/u/Przemyslaw_Krauze)\
**Post date:** [April 29, 2020, 4:23pm UTC](https://forum.dynamobim.com/t/fail-to-load-library-at-excel-workbooks-open/16225/9 "2020-04-29T16:23:15Z")

</div>

Hi, I’m facing similar issue, have you found solution?
