The JArchi scripting plugin for Archi opened up some interesting possibilities for getting data in and out of an Archi model. The standard Archi export to CSV allows you to export an entire model to CSV. It creates three CSV files, one for elements, one for relationships and one for properties. To recombine these files, you need to import them into a spreadsheet or database, and join or lookup the values based on the unique keys.
I needed an export function which would allow me to export all elements within a given view, exporting the standard attributes and custom properties as headers. After putting my Export to Markdown script together, I felt like I could try and take a crack at putting this together in JArchi, with the hope that once I managed to export to data, I could update the values in a spreadsheet, and re-import the data (spoiler alert, Import from CSV is here, I’ll put a more detailed post together soon).
The jArchi script to Export to CSV is available on GitHub Gists.
This script requires PapaParse. Download the papaparse package, and extract the papaparse.min.js script into a “lib” folder in the same location as the Export to CSV.ajs script in your jArchi script folder.
This script will:
- Define the standard headers (Name, Documentation, UID, Type)
- Loop through all elements contained in the view.
- Note all properties
- Extract all relationships
- Use PapaParse to write all elements and properties to CSV
- Use PapaParse to write all relationships to CSV