Fork me on GitHub
2sxc 8.9 for DNN 7 to 9
Website Builder, Content Manager, App-System: free and amazing - done your way
You are here: Home  >  Learn  >  Content Export and Import

Content Export and Import

Content Export and Import

Come here if you're trying to do content-editor things like:

  1. Import data from Excel or into 2sxc - like addresses, lists of products and similar
  2. Do mass-operations like mass-editing or delete many content-items
  3. Export data for mass-translation, to then re-import another language
  4. Migrate data to/from another DNN tool like Form and List, XMod, r2i OWS, DNNMushroom, Packflash or similar with 2sxc
  5. Import content to/from another .net CMS like UmbracoSitefinity, Kentico, SharePoint or sitecore with DotNetNuke
  6. Import content to/from another CMS like Wordpress, Joomla, Drupal, typo3 with DNN

This page is targeted at content-editors. For advanced import/export and data-integration topics as well as accessing SQL-data (which are usually developer topics) we'll create a separate help section. 

Basics of Content Export and Import

Before we start, let's get a few basics understood

  1. Content is very flexible - so some content-items could have 3 fields (Title, Body, Image) while others have many fields (like an address having 20 fields)
  2. Content is sometimes multi-lingual - so some fields may be translated into many other languages
  3. When content is multi-lingual, 2sxc needs to know which fields are translated, and which should automatically show the default language...
  4. ...and 2sxc must know, which is the default language

To accomodate for all these possible scenarios, 2sxc expects the import-data to be in a structure that it understands. This is a simple XML-format, which can be edited in Excel. This is all rather simple - but requires you to know 1-2 tricks for working with the data.  

Export-Dialog

In general it's self-explaining, here some details you may not figure out yourself:

  1. If all you need is a template to fill in your data - go ahead and choose Export data: No, just export blank... 
  2. The Value-References are internal references how languages work. This is important to ensure that a re-import will create the identical state as the system currently has. So if the DE title is not translated it will export as [] (meaning empty) or if it references the Ukraine title it would be something like [ref(uk-UA,rw)]. If you choose to replace references, then the export would contain real text - which would also be imported again later on. 
  3. File/page reference behaves the same way. If you plan on re-importing the content (after editing it), then you should use the references.

Import-Dialog Step 1 of 3

The Import Dialog has 3 steps - so that you can preview what's about to be changed if you perform the import. You must only know...

  1. That the import requires you use the official file-structure. If you don't have this yet, create one from the export-dialog. 

Note that pressing Preview Import will not import the data yet but run various test on the data. 

Import-Dialog Step 2

This too is very simple - it shows you what the tool found and what it's about to import. 

Import Dialog Step 3

This is usually just your normal success message. If anything goes wrong - do tell us :)

Working with Data in Excel

Excel can help you work with XML-Data, but you must know 2 important tricks. This is the general process:

  1. Export data (or empty template-xml) from 2sxc
  2. Open in Excel
  3. Work with the data as needed, save as Excel while you're working
  4. Export back into XML for re-import later on

If you do this you should see your data in a colored table as shown in the image, always starting with a GUID column and a Language column. These are explained more below. 

Opening the XML in Excel

You can just open the XML directly in Excel with

  1. Use the normal File > Open 
  2. Pick your file
  3. In the dialog appears just click Ok

Saving the Excel for Re-Import

While working with the data and just pressing save, Excel will usually create an Excel file (.xls or .xlsx) for you. When you're ready to re-import, just save it as XML. The resulting file should work for re-importing.  

  1. go to FileSave As in Excel
  2. choose XML as the desired format. 

Common Export / Import for Content-Editors

In the following sections we'll guide you through common import/export actions which a content-editor might want to do. 

Mass-Editing existing content

Do the following

  1. Export the data
  2. Mass-edit in Excel
  3. Save-As XML
  4. Re-Import

A few tips:

  • The GUID column is important to ensure that the correct data gets imported. Make sure it still has the original GUID after updating the data. 
  • In case you're using formulas to mass-edit your data, make sure you copy them out and paste-as-values before re-importing
  • If you want to add more content-items you can do this - just add more rows with an empty GUID

Mass-Translating Existing Content

Go ahead as follows

  1. Export your data in your main language so that you have 1 row per content-item
  2. Open in excel
  3. Change the Language to your new desired language - make sure it has the correct code like "de-ch" 
  4. Now you can write in all translations as you need to...
  5. Save as XML, re-import, and you're set

Some specials you may want to know

  • Writing [] into any field (an open [ and a close ]) will tell 2sxc that this is not translated. So this will automatically fall back to show the value of the original language
  • Writing [""] into any field (an open [, two quotes " and a close]) will tell 2sxc that it's translated at it should be an empty text for this language
  • Writing [ref(...)] will tell 2sxc that this value should be the same value as that from another language specified
  • Make sure that the GUID in the first row stays as it was - 2sxc uses this to match content-items across languages

Mass Deleting Content-Items

If you wish to mass-delete some content items - for example if you had 300 products and want to remove 75 - this can be done quickly with export-import. 

  1. Export the list
  2. Remove all items using Excel
  3. Re-import but set the option Remove all entities not found in import

Update Columns/Fields with new Values

This is the first of 2 common update/sync cases: When you want to update some fields on most content-items with the updated value from another list. Typical examples are:

  1. The price on all items must be updated, and the new price is in an existing list
  2. Product infos must change - and the supplier sent you an excel-list

The process is as follows:

  1. Export existing data
  2. Open in excel, use formulas to look up the new data from the external list using VLOOKUP (see image)
  3. When you're happy, re-export as XML (the VLOOKUPs will be removed automatically and replaced by the value)
  4. and import back into 2sxc

Synchronize List with External List

This is the second of the most common 2 cases: You already have a list with X items, now you want to keep some and add others based on a new list. Examples are:

  1. The employees have changed - some were added, some removed
  2. You want to mass-delete many content-items

To do this, just export the content the normal way, then remove all the items you don't want and re-import using the option shown in the image. 

Importing new data

When importing new data - for example addresses or products that don't exist yet in 2sxc - you must do the following:

  1. Go to 2sxc and export a template-import-file which contains the correct structure for re-importing later on. Of course this requires that your designer or developer already created a content-type for your data to import. 
  2. Open the template-file in excel
  3. Add your content to the table with copy-paste or similar
  4. Save as XML
  5. Re-import

That's it. If you have more questions regarding the GUID or languages - you'll find answers further below. 

Note that if you ever want to sync data again (for example, to update parts of the data like the price) you should have some kind of ID in your data (to help matching in the future). If your data has GUIDs you could use that (then place it in the GUID column), otherwise it would be wise to also import the external ID into one of the columns as well. 

Special Codes / Placeholders in the Export-File

You may see the following things in an export - so here's what they mean:

  1. File:37 - this means that we're pointing to a file in DNN, and this is the internal DNN-number. If you would rather have the full file-name, there's a switch in the export dialog to deliver the full path. 
  2. Page:105 - same thing - a page in DNN
  3. [""] - this is a special placeholder saying that there is a value, but it's an empty piece of text. This is important for the re-import, because otherwise the XML would remove the value (which is not the same thing as an empty value) and cause side-effects. So importing a ="" will replace the existing field with an empty text. 
  4. [] - this is a special placeholder saying that there is no value stored - or if you re-import this, that any stored value is removed. 
  5. Difference between [""] and []      
    1. In a multi-language environment, any field containing [] (meaning no value) will automatically deliver the same field in the original language. So no value means "This is not translated, please take the default value". But a field containing [""] (meaning value is empty text) will mean "this field is translated, and the translation is an empty text". 
    2. In a single-language environment they have almost the same effect - but it could be that your output-templates check for empty values. For example, you could have a template showing a "Author unknown" message if the Author-field is empty, then removing the field [] could have side effects. 
    3. In general: if you don't have a specific reason for replacing / removing one of these placeholders, it's best to leave them the way they are
  6. [ref(en-US,ro)] - this only exists on multi-language data and means that this value specifically references (uses) the value from the language specified in the brackets. The remaining code gives additional hints about read/write-share information - but in most cases you don't need to understand it as these are advanced use scenarios. 

Advanced Cases for Import/Export of Content

The following are special use cases which I would like to explain

  1. When importing data which already has a GUID as identity (for example if your products have a GUID or your addresses have a GUID in the CRM), then you can use this GUID in 2sxc as well. Just place the GUID in the GUID column. 
  2. When importing content to update parts of a list you can import a short list containing only changed content-items. By default, all other content-items will be untouched. 

Special Multi-Language scenarios

  1. When importing multiple languages at the same time you can give all matching content-items the same GUID or you can leave the GUID empty. 
  2. If you leave the GUID empty, the import will then detect which ones belong together based on the order they are in the list. So every row after the first is "the same item" until a row appears with the same language as the first row. The import will then expect that each content-item has the same amount of rows. 

Relationships to other data

If you have a field like Author which points to another Content-Item you can also export/import these references. 

  • If you need just one value, just put the GUID of the target into the field
  • If you need multiple values, put all the GUIDs there, comma separated

If you are importing complex data with multiple tables, it's easiest to

  1. first import the pointed-at-data (like the Authors)
  2. if you did not import GUIDs (which is usually the case) then re-export the authors - you now know what GUID they have...
  3. based on this list and some VLOOKUP-magic in Excel, add the Author-GUIDs to the data you want to import
  4. ...and finally import those tables

Note that you can import the lists in any sequence you like - since you can re-import them again after the pointed-at-data exists. So if an employee points to another employee (like the boss), then just do the initial import without the reference and re-import it again with the references. 

Multi-Language Scenarios

  1. When importing multiple languages at the same time you can give all matching content-items the same GUID or you can leave the GUID empty. 
  2. If you leave the GUID empty, the import will then detect which ones belong together based on the order they are in the list. So every row after the first is "the same item" until a row appears with the same language as the first row. The import will then expect that each content-item has the same amount of rows. 
2serve . 2invent . 2create is 2be.