Data from previous dataset remains after load

Feb 10, 2010 at 10:33 PM


I have developed some customization to NodeXL, among other things a graph loader for a format specific for my client. We have an issue, but only on maybe 1 out of 10 or 20 loads: Some data from the previous dataset remains in the sheets after the new dataset is loading and is causing the graph to be incorrect. I am letting the custom graph loader produce a new IGraph instance through GraphFactory.CreateGraph, and use the LoadGraph method to load it into the spreadsheet like it was done for the built-in graph loaders. There is never a problem when a dataset is loaded into an empty workbook, only when a dataset is already loaded. Since I am using the standard way to generate and load graphs I believe the problem is inside the NodeXL code somewhere, but since there is no well-defined way to reproduce the error it is very hard to debug. I have used the code from changeset 37890, and wonder if anything in the two later changesets could fix the problem.

Has anyone had similar problems, and maybe found a way to fix it?

Best regards
Hendrik W. Hansen

Feb 10, 2010 at 11:14 PM
Edited Feb 11, 2010 at 5:18 PM


I'm not sure I understand what you are doing.  Did you customize the code in the ExcelTemplate project so that you can import custom data into the NodeXL workbook?  If so, you don't need to do that.  Instead, you can implement a custom "graph data provider" that gets your custom data and formats it as GraphML.  Graph data providers are loosely coupled to the Excel workbook and don't need to deal at all with graph classes or workbook contents.  Please see "For Programmers: About NodeXL Plug-Ins" at

But if you have indeed customized the ExcelTemplate code, are you calling ThisWorkbook.ImportGraph()?  That's the method that gets called whenever anything is imported (including data from a custom graph data provider), and it automatically takes care of clearing the workbook contents if the user has checked "Clear NodeXL Workbook First" in the NodeXL, Data, Import menu.  I have not seen any failures myself in that area of the code.

-- Tony

Feb 16, 2010 at 9:30 PM

Hi Tony,

Thank you for the answer, sorry for the late reply.

You are right in your assumption about what I did, and you are probably right that it could have been done more easily using a custom graph data provider. However I also needed to add some custom calculations and data corrections with corresponding buttons on the ribbon bar, so I think I had to change the the template anyway.

We use the option to clear the workbook before load, but even then some old data still "survives" once in a while. Like I said, it is only happening once in while, which makes it very hard to debug. It could be related to Excel itself. My plan is to clear the ListObjects for edges and vertices before load to see if that makes the problem go away. Otherwise I think they can accept having to close and reopen NodeXL once in a while.

Best regards

Feb 16, 2010 at 9:43 PM


I'm baffled as to why this is occurring in your application, and of course intermittent, seemingly random problems are the hardest to solve.

You didn't say whether you are calling ThisWorkbook.ImportGraph(), which automatically clears the workbook before importing, but I'll assume that you are.  If you want to experiment, you can call NodeXLWorkbookUtil.ClearTables() first to see if that has any effect, or clear the tables with your own code.

If you find the problem, or at least a repro case, please let me know.

-- Tony