Overview
Collection content can be exported to a CSV file, which can be opened and edited within spreadsheet programs like Microsoft Excel.
This export option is particularly useful for either of the following two scenarios:
- If you need to make bulk changes across multiple items in the same collection.
- If you want to reorder items in the same collection.
This article reviews the Export process and then discusses the abovementioned scenarios.
Exporting collection content
Here is the process for exporting collection content:
- Open the collection on the Content tab of Headless CMS.
- Click the "Content Import/Export" button above the table.
- In the "Export Collection" section, click the "Download CSV file" button.
The name of the resulting CSV file is Export-[name_of_the_base]-[name_of_the_collection]-UTCdateTime. For example, if we export the collection "Menu Items" from the base "Restaurant" at exactly 12pm UTC on 4-Jan-2024, the file name would be:
Export-restaurant-menu_items-2024-1-4T12_00_00.000Z.csv
How each property type appears in the CSV file
- For Text, Boolean, Number, Color, DateTime
The values in the CSV are identical to their values in the base.
(Booleans not assigned a value in the base will also not be assigned a value in the CSV. Missing values for Booleans are interpreted as meaning "False".) - For Image, Video, Document, Audio, 3D Model
The values in the CSV file are the names of each media file in the base. The actual media is not exported. - For Long Text
The values in the CSV file are autogenerated file names with a .txt extension. The actual text is not exported.
Structure of the CSV file
The first row of the CSV file - also known as the "header" - is a comma-separated list of properties in the structure of your target collection.
- The first property is "Item ID", a value assigned to each item by Headless CMS.
- Then, all variants are listed. Variant names are preceded with the letters "v_". For example, a variant named "Language" would be represented in the CSV file as "v_Language".
- Finally, all other properties in the collection structure are listed.
The following image shows part of a collection exported from an H-CMS base supporting a Poster Gallery. This collection has two variants: Style, Language.
Though not indicated in the export, "Style" is a collection-level variant, while "Language" is a property-level variant. Note the following while looking at the export example above:
- The Item ID remains the same when a property-level variant changes - e.g. both Rows 2 and 3 have the same Item ID because only the property-level variant "Language" has changed.
- The Item ID would change when a collection-level variant changes - e.g. when the value of the "Style" variant changes to something other than "Classic".
Usage One: Bulk editing
Bulk editing is the ability to update multiple items using a single (or at least minimal) steps. For example, you may need to change the color of multiple items in your collection. You could change that color value one item at a time in Headless CMS, or you could make a bulk change in the CSV file.
- Export your collection.
- Open the CSV file in Excel (or your favorite spreadsheet program)
- If you're asked
- the first row contains column titles
- the separator character is a comma
- If you're asked
- Add and/or modify items following Step Three in the Import Content article.
- Import the updated CSV file by following Step Four in the Import Content article.
All changes in the CSV file will overwrite the original values in the base when imported.
NOTE: You can also add items using the CSV file. Removing an item from the CSV file, however, will NOT delete the associated item in the base. To remove an item, you must remove it using Headless CMS.
Usage Two: Reordering items
Item reordering is a multi-step process that includes deleting the original collection's contents and then importing a complete replacement. This means you must have access to all of the media files added to the original collection. Be sure to follow this process very closely to ensure you don't lose critical information.
- Export your collection.
- Open the CSV file in Excel (or your favorite spreadsheet program)
- If you're asked
- the first row contains column titles
- the separator character is a comma
- If you're asked
- Reorder items as necessary.
- Optionally, add and/or modify items by following Step Three in the Import Content article
- In Headless CMS, for the original collection you exported, use the "Delete all items" collection option to remove all contents.
- For that now empty collection, import the updated CSV file by following Step Four in the Import Content article. This step will include the uploading of any media file used in the original collection.
Comments
0 comments
Please sign in to leave a comment.