dot net driver for neo4j - can it be made com scriptable?

65 views
Skip to first unread message

John Singer

unread,
Sep 30, 2017, 11:37:30 AM9/30/17
to Neo4j
I would like to script the neo4j.driver dotnet library from excel VBA.  My understanding is that dotnet dll's can be made com scriptable - has anyone worked out how to do this or will Neo4j need to provide this capabality?  

Davis Rogers

unread,
Jan 18, 2018, 6:29:20 PM1/18/18
to Neo4j

https://www.easysoft.com/support/kb/kb01098.html


This example uses a Visual Basic for Applications (VBA) subroutine to retrieve nodes from sample Neo4j graph Movies. Note that it is not possible to use Excel's GUI tools (Data Connection Wizard / Microsoft Query) to work with Neo4j data. They are SQL-based applications and are not compatible with a cypher-based graph database.

  1. Create a new Excel spreadsheet.
  2. Press ALT+F11 to start the Visual Basic Editor.
  3. In the Visual Basic Editor, in the Project Pane, double-click Sheet1 in the list of Objects.
  4. In the Code Window, add the following VBA code:
    Option Explicit
    
    Public Sub GraphNodesIntoExcel()
    
        Dim con             As New ADODB.Connection
        Dim rs              As New ADODB.Recordset
        Dim lngCounter      As Long
        Const strcQuery     As String = "MATCH (people:Person) RETURN people.name LIMIT 10"
    
        ' Replace Neo4j with the name of your ODBC data  source.
         con.Open "Neo4j"
         rs.Open strcQuery, con
    
         If rs.EOF Then Exit Sub
    
         With rs
             ActiveSheet.Range("A1").Offset(0, 0).Value = .Fields(0).Name
             lngCounter = 1
             Do Until .EOF
                 ActiveSheet.Range("A1").Offset(lngCounter, 0).Value = .Fields(0).Value
                 .MoveNext
                 lngCounter = lngCounter + 1
             Loop
         End With
    
        rs.close
        con.Close
    
        Set rs = nothing
        Set con = nothing
    
    End Sub
    
  5. On the Run menu, choose Run Sub/UserForm to run the new subroutine.

    If you get the error "User Defined type not defined.", on the Run menu, choose Reset. On the Tools menu, choose References. In the References dialog box, choose Microsoft Active X Data Objects n Library, and then click OK. Run the subroutine again.

Michael Hunger

unread,
Jan 19, 2018, 7:06:13 AM1/19/18
to ne...@googlegroups.com
Thanks a lot Davis,

there was also some earlier work: 


Cheers, Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Hunger

unread,
Jan 19, 2018, 7:51:44 AM1/19/18
to ne...@googlegroups.com
Here is another project from a colleague of mine, that uses the .net driver.


Cheers, Michael

On Sat, Sep 30, 2017 at 5:37 PM, 'John Singer' via Neo4j <ne...@googlegroups.com> wrote:
I would like to script the neo4j.driver dotnet library from excel VBA.  My understanding is that dotnet dll's can be made com scriptable - has anyone worked out how to do this or will Neo4j need to provide this capabality?  

--
Reply all
Reply to author
Forward
0 new messages