Skip to main content
Solved

Script that allows bulk conversion of draw.io diagrams into LucidChart diagrams


Forum|alt.badge.img+3

I'm trying to create a Python script that will download the drawio files in XML or drawio formats from a list of spaces that contain pages containing drawio macros and automatically upload them to LucidChart via its API. Once the files are converted, they will automatically have new IDs generated by Lucidchart that we will use in a mapping table that will be useful later. This mapping file is really important to know where to replace the old macros by the new ones. We will need the following columns: Space Key, Page Title, Page ID, Drawio file name.

We will have to use this CSV mapping file, completed with the IDs of the new Lucidchart documents, to replace the old drawio macros with the new Lucidchart macros. (This is done using HTML tags.) This way, the new pages will be updated with the new Lucidchart files.

 

I’m still struggling to get this mapping file from my script. Anyone could help me on this?

Best answer by Richard U

Hi ​@lnguyenduc , thank you for contributing to the Lucid for Developers Community!

At the moment, our REST API does not support importing Draw.io files to Lucidchart diagrams. Though, this can be accomplished through the Lucidchart editor’s Import Diagram option (Draw.io import details in our Help Center).

That said, your use case sounds really interesting. Are you looking to automate Draw.io imports for a one-time migration, or is this part of an ongoing workflow? I’d also love to hear what happens after import - are you modifying the diagrams, analyzing them, or integrating/embedding them somewhere else? And when you mentioned “macro replacement,” are those macros hosted in Confluence? Just wondering if you're looking for something similar to our Gliffy > Lucidchart converter in our Confluence plug-in.

This kind of feedback is incredibly helpful for our product team as we explore future enhancements.

Looking forward to hearing more about your project.

View original
Did this topic help you find an answer to your question?

Richard U
Forum|alt.badge.img+8
  • Lucid support team
  • March 28, 2025

Hi ​@lnguyenduc , thank you for contributing to the Lucid for Developers Community!

At the moment, our REST API does not support importing Draw.io files to Lucidchart diagrams. Though, this can be accomplished through the Lucidchart editor’s Import Diagram option (Draw.io import details in our Help Center).

That said, your use case sounds really interesting. Are you looking to automate Draw.io imports for a one-time migration, or is this part of an ongoing workflow? I’d also love to hear what happens after import - are you modifying the diagrams, analyzing them, or integrating/embedding them somewhere else? And when you mentioned “macro replacement,” are those macros hosted in Confluence? Just wondering if you're looking for something similar to our Gliffy > Lucidchart converter in our Confluence plug-in.

This kind of feedback is incredibly helpful for our product team as we explore future enhancements.

Looking forward to hearing more about your project.


Forum|alt.badge.img+3

Hi ​@Richard U 

Yes, actually, I just migrated Jira and Confluence from one instance to another in Cloud-to-Cloud.
In the source Confluence instance, users were using Draw.io and a plugin that allowed them to display diagrams directly in Confluence pages with macros.
In the destination Confluence instance, users were using LucidChart instead, along with a plugin that allowed them to display LucidChart diagrams directly in Confluence pages with macros.

So the idea is simply to convert all the draw.io diagrams on the pages that were migrated from the source instance to the destination instance into LucidChart diagrams. The pages would need to be able to contain the new diagrams as attachments and the pages would need to be able to display the LucidChart diagrams instead.

I thought a script could do this. So the rest of LucidChart's API isn't capable of this?

Yes, I'm looking for something similar to Gliffy > Lucidchart converter, but since I hadn't seen this feature, I tried to create a script for it.

However, users need this conversion before the end of the next two weeks. Can you help me find a solution for this?


Forum|alt.badge.img+3

Anyone here for supporting me on that? ​@Richard U ?


Richard U
Forum|alt.badge.img+8
  • Lucid support team
  • April 1, 2025

Hi ​@lnguyenduc, I need to correct my original comment. Draw.io is a supported file type for our Import Document API after all. You can programmatically import .drawio or .xml files using our Import Document endpoint.

Is this what you’re looking for?

 


Forum|alt.badge.img+3

Yes ​@Richard U 


Forum|alt.badge.img+3

@Richard U Any update?


Richard U
Forum|alt.badge.img+8
  • Lucid support team
  • April 7, 2025

Thanks for following up! We’ll continue assisting in your other post about the errors you’re encountering so we can keep everything in one place.

 


Forum|alt.badge.img+3

I managed to make the script work!!!! It could be helpful to any other people if needed. 


Reply