JArchi Scripting: Import From CSV

A couple of weeks back, I posted my jArchi script for exporting a view from Archi into CSV format to load into your spreadsheet application of choice. This week, I’ll go through the other side of the equation, once you’ve dumped your view to Excel, made your changes, how you can go about getting those amendments back into Archi.

Quick warning, this shouldn’t hose your model, but please backup your model first, just in case!

Here is the Import from CSV jArchi script from 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 Import from CSV.ajs script in your jArchi script folder.

This script will:

  • Prompt for a CSV file (in the format generated by the Export to CSV script)
  • Load the CSV and parse using PapaParse
  • For each row in the CSV
    • Attempt to match the Archi Concept in the row using the UID in the CSV.
    • If there is no UID, attempt to match the Archi Concept using the Object Name
    • If there are no matches, or more that one match was found, create a new Archi Concept using the common properties, Name, Documentation and Type, else update the matched concept with the matched details.
    • Loop through all other columns in the CSV.
      • If the row has a value in this column, update the property on the Archi Concept with the value.
      • If the row doesn’t have a value in the column, remove the property from the Archi Concept

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.