Draw.io import diagrams from CSV using an API

1.9k Views Asked by At

In draw.io there is a very nice option to create a diagram using CSV import utility (Arrange->Insert->Advanced->CSV). It is very simple and straight forward.

I was trying to find a way to do it using an API (REST for example), is there a way to do it?

One more question: Does anybody knows if there's a way to create draw.io file with multiple pages using the CSV import utility?

Thanks Danny

1

There are 1 best solutions below

0
On

Absolutely possible. Working example here: https://github.com/GanizaniSitara/drawio/

pyMX.py you want to have a look at first.

It creates the file in XML then encodes it and packs it into the drawio format.

Needs input data in CSV in format:

Level0,Level1,Level2,AppName,TC,StatusRAG,Status,HostingPercent,HostingPattern1,HostingPattern2,Arrow1,Arrow2,Link Cool Division,Some Department,Some Department2,SomeString,Zero,25,red,green,0,Azure,Linux,up,up,http://www.gooogle.com

Rinse and repeat for anything else you need to create. It's rough code, ping me here or on GitHub if anything needs clarification.