A Tool for enabling Mass modifications of Folders and Assets on Preservica through Spreadsheets
Project description
Preservica Mass Modification Tool
A Python CLI for making bulk updates to existing Preservica entities from a spreadsheet.
The tool supports XIP metadata updates (title, description, security), identifiers, retention policy updates, moves, optional delete mode, XML metadata merge/update, descendant processing, and optional upload-mode workflows.
This tool relies on making various API calls which may be limited by your version of Preservica.
Table of Contents
- Quick Start
- Version & Package Info
- Why Use This Tool?
- Key Features
- Authentication
- Input Spreadsheet
- XML Metadata
- Descendants Mode
- Continue/Resume Behaviour
- Options File
- CLI Reference
- Examples
- Troubleshooting
- Developers
- Contributing
Quick Start
1) Install
pip install -U preservica_mass_modify
2) Run with username/server (password prompt)
preservica_modify \
-i /path/to/updates.xlsx \
-u your.username@example.com \
-s yourtenant.preservica.com
3) Run with credentials file
preservica_modify \
-i /path/to/updates.xlsx \
--use-credentials /path/to/credentials.properties
Version & Package Info
Python Version
- Python 3.10+ recommended
Core dependencies
pypreservicapandasopenpyxllxmlkeyring
Why Use This Tool?
This tool is designed for operational bulk-change workflows where many entities must be updated consistently and safely from tabular input.
Typical use cases:
- Apply metadata changes to many entities at once
- Add/update identifiers in a controlled way
- Update retention assignments in bulk
- Add or merge XML descriptive metadata templates
- Apply updates to descendants of selected folders
Key Features
- Spreadsheet-driven updates for Preservica folders/assets
- Drop-in/drop-out column model (only columns present are acted on)
- Optional blank override mode (
--blank-override) for intentional clears - XML metadata support (
exactorflatmatching) - Print/convert local or remote XML templates for spreadsheet preparation
- Descendant processing with fine-grained include flags
- Optional keyring-based password retrieval/storage
- Continue token support to resume after interruption
- Dummy mode for dry-run style validation of flow
Authentication
You can authenticate using either:
--use-credentials(recommended for scheduled/automated jobs)-u/--usernamewith-s/--server(interactive)
Credentials File
If no path is supplied, the CLI looks for credentials.properties in the current working directory.
Example:
username=your.username@example.com
password=your-password
server=yourtenant.preservica.com
tenant=optional-tenant
Username + Keyring
preservica_modify \
-i /path/to/updates.xlsx \
-u your.username@example.com \
-s yourtenant.preservica.com \
--use-keyring \
--save-password
--use-keyring: retrieves stored password first--save-password: stores entered password for future runs--keyring-service: defaults topreservica_modify
Input Spreadsheet
Current CLI validation accepts:
.xlsx.csv.json.xml
Note: internal dataframe loaders support additional formats, but CLI-level validation currently enforces the two formats above.
Required Columns
At minimum, include:
Entity Ref
For explicit entity lookup mode, also include:
Document type(SOfor folder,IOfor asset)
If Document type is omitted, the tool attempts lazy entity resolution (asset first, then folder).
Supported Metadata Columns
TitleDescriptionSecurity
Only present columns are used.
Identifier Columns
Supported patterns:
Identifier(defaults key tocode)Identifier:<key>(custom identifier key)Archive_Reference(defaults key to configured identifier defaultcode)Accession_Reference(defaults key to configured accession keyaccref)
Retention / Move / Delete Columns
Retention PolicyMove to(UUID format expected)Delete(requires delete mode and credentials file)
XML Metadata
XML templates can be read from local metadata directory or from your Preservica system.
Print/Convert Local XML Templates
preservica_modify -i /path/to/input.xlsx --print-xmls
preservica_modify -i /path/to/input.xlsx --convert-xmls xlsx
Print/Convert Remote XML Templates
preservica_modify -i /path/to/input.xlsx -u user -s server --print-remote-xmls
preservica_modify -i /path/to/input.xlsx -u user -s server --convert-remote-xmls csv
Exact vs Flat Matching
Enable metadata mode with -m / --metadata:
# Defaults to exact if -m supplied without value
preservica_modify -i /path/to/input.xlsx -u user -s server -m
preservica_modify -i /path/to/input.xlsx -u user -s server -m exact
preservica_modify -i /path/to/input.xlsx -u user -s server -m flat
exact: path-based matching for more deterministic updatesflat: local-name style matching for simpler spreadsheets
Descendants Mode
Apply updates to descendants using -d/--descendants with one or more options:
include-assetsinclude-foldersinclude-titleinclude-descriptioninclude-securityinclude-retentioninclude-xmlinclude-identifiers
Example:
preservica_modify \
-i /path/to/input.xlsx \
-u user -s server \
-d include-assets include-xml include-identifiers
Continue/Resume Behaviour
The tool stores progress in a continue token file alongside your input file:
<input_file>_continue.txt
On interruption (Ctrl+C), progress can be resumed on the next run.
Resume handling is enabled by default in the current CLI workflow.
Options File
Column names and certain defaults can be changed via options properties file.
Default path:
preservica_modify/options/options.properties
Override with:
preservica_modify -i /path/to/input.xlsx -u user -s server -opt /path/to/options.properties
Current defaults include:
ENTITY_REF=Entity RefDOCUMENT_TYPE=Document typeTITLE_FIELD=TitleDESCRIPTION_FIELD=DescriptionSECURITY_FIELD=SecurityRETENTION_FIELD=Retention PolicyMOVETO_FIELD=Move toDELETE_FIELD=DeleteIDENTIFIER_FIELD=IdentifierIDENTIFIER_DEFAULT=codeFILE_PATH=FullName
CLI Reference
Core
-i, --input(required)--dummy--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}--log-file [PATH]-opt, --options-file PATH
Modification options
-del, --delete-up, --upload-mode-clr, --blank-override-d, --descendants ...
XML metadata options
-mdir, --metadata_dir PATH-m, --metadata [flat|exact]--print-xmls--print-remote-xmls--convert-xmls [xlsx|csv|json|ods]--convert-remote-xmls [xlsx|csv|json|ods]
Authentication options
--use-credentials [PATH]-u, --username USERNAME-s, --server SERVER--tenant TENANT--use-keyring--save-password--keyring-service NAME--test-login
Examples
Test credentials only
preservica_modify -i /path/to/input.xlsx -u user -s server --test-login
Update title/description/security from spreadsheet
preservica_modify -i /path/to/input.xlsx -u user -s server
Apply XML updates from local metadata templates
preservica_modify \
-i /path/to/input.xlsx \
-u user -s server \
-mdir /path/to/metadata \
-m exact
Clear values using blanks intentionally
preservica_modify -i /path/to/input.xlsx -u user -s server --blank-override
Delete mode (credentials required)
preservica_modify \
-i /path/to/input.xlsx \
--use-credentials /path/to/credentials.properties \
--delete
Troubleshooting
- Invalid input file: ensure
--inputpoints to an existing.xlsxor.csvwhen running CLI validation. - Login failures: verify server format, username/tenant, or credentials file values.
- Delete mode blocked: delete requires
--use-credentials. - No updates happening: confirm column headers match configured names exactly.
- XML not applied: check metadata mode (
flatvsexact) and template/header alignment. - Move failures: ensure
Move tovalues are valid UUIDs. - Resume confusion: remove stale
<input>_continue.txtto force full restart.
Developers
Local install
python -m venv .venv
source .venv/bin/activate
pip install -e .
Run tests
pytest
Contributing
Issues and pull requests are welcome.
- Homepage: https://github.com/CPJPRINCE/presvica_mass_modify
- Issues: https://github.com/CPJPRINCE/presvica_mass_modify/issues
Please include:
- CLI command used
- input sample (sanitised)
- expected vs actual behaviour
- traceback/log excerpts
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file preservica_mass_modify-1.1.2.tar.gz.
File metadata
- Download URL: preservica_mass_modify-1.1.2.tar.gz
- Upload date:
- Size: 47.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a30c732a768ef2eadea14d38f7a965476fa0ff11f7366ac0ba23b5b5bec67cff
|
|
| MD5 |
967a3089692f08e02daae7c783a6b107
|
|
| BLAKE2b-256 |
f56ae2cdae36a555dee7a3ad4fca6df4d969579e7963f161ecef395d4e42c6f1
|
Provenance
The following attestation bundles were made for preservica_mass_modify-1.1.2.tar.gz:
Publisher:
pypi-publish.yml on CPJPRINCE/preservica_mass_modify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
preservica_mass_modify-1.1.2.tar.gz -
Subject digest:
a30c732a768ef2eadea14d38f7a965476fa0ff11f7366ac0ba23b5b5bec67cff - Sigstore transparency entry: 1252482531
- Sigstore integration time:
-
Permalink:
CPJPRINCE/preservica_mass_modify@7619fe9932e5e3634c9771871999bab97b7ed5c5 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/CPJPRINCE
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@7619fe9932e5e3634c9771871999bab97b7ed5c5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file preservica_mass_modify-1.1.2-py3-none-any.whl.
File metadata
- Download URL: preservica_mass_modify-1.1.2-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4da0a5e123f1d40fe7444ac44423a276c07b6b3a74fd403419e0e9b6a924b5ea
|
|
| MD5 |
3d8df4d0f93c1cc05dc74972b783c016
|
|
| BLAKE2b-256 |
84ded7f0f428e09b567b499627ca63f6947caa59dea5bfb57dff6079a86800b7
|
Provenance
The following attestation bundles were made for preservica_mass_modify-1.1.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on CPJPRINCE/preservica_mass_modify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
preservica_mass_modify-1.1.2-py3-none-any.whl -
Subject digest:
4da0a5e123f1d40fe7444ac44423a276c07b6b3a74fd403419e0e9b6a924b5ea - Sigstore transparency entry: 1252482556
- Sigstore integration time:
-
Permalink:
CPJPRINCE/preservica_mass_modify@7619fe9932e5e3634c9771871999bab97b7ed5c5 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/CPJPRINCE
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@7619fe9932e5e3634c9771871999bab97b7ed5c5 -
Trigger Event:
push
-
Statement type: