Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

How do I import nodes, edges and groups from a spreadsheet?

+2 votes

 

I decided to throw together a quick and dirty Ruby script to keep me going until importing groups is available natively. This is not very well tested but it is working for me so far. This is pre-alpha level test code, but I thought it was worth posting in case anyone else finds it useful. 

The basic approach I have taken is to convert an xls file to gml format which can then be imported to yEd.

Usage:

1. Create an Excel (.xls) spreadsheet (not .xlsx). Ths script assumes the data is in the first sheet.

2. Column A contains the actions

A B C D
node node name optional node label  
group group name optional group label  
memberof node or group name group name  
edge node or group name node or group name optional label

For example:

A B C
edge nodeA nodeB
memberof nodeA group of nodes
node nodeB Label for node b

Note: The name of each node and group must be unique for this to work! Be careful with special characters in node and group names as I have done no testing.

3. Save and close the spreadsheet (Excel holds an exclusive lock on the file which stops roo from parsing it)

4. Run the following script with Ruby and pass the xls file as a parameter

For example,

ruby xlstogml.rb t1.xls

5. Grab the gml from the command line either using copy and paste or redirection and import the gml file. I then usually do a quick test using hierarchical layout to check the integrity.

Note: You need to have Ruby installed (I am using 1.9.x) and the gem 'roo' installed to parse spreadsheets. Please refer to ruby web sites for instructions on how to do this.

Source code for xlstogml.rb

in Help by (210 points)
edited by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Legal Disclosure | Privacy Policy
...