ckanext-officedocs
This plugin provides the option of using the Microsoft Office Web Viewer for previewing both MS Office and OpenOffice documents as an IResourceView
Also consider ckanext-webpageviewplus
ckanext-webpageviewplus (from version 0.7.0) shows Word, Excel and PowerPoint files through the same Microsoft viewer, as one of the well-known services in its "Website (Plus)" view, and adds what this extension doesn't:
- a security setting per view, so the embedded viewer can't act as your CKAN site;
- a consent card, so visitors can choose before anything loads from Microsoft (each preview sends the visitor to Microsoft and gives Microsoft the file's address);
- a height that fits (16:9 for slides), a control bar with Open in new tab, Fullscreen (Expand on iPhone) and Share, lazy loading, and accessibility work;
ckan webpageviewplus check-views, which lists views whose page has gone.
It needs a separate domain for uploads: Microsoft's viewer only works with its own origin, and ckanext-webpageviewplus never gives one to an embedded page until uploads are served from a separate domain. On sites without one, keep using this extension, which embeds the viewer without a sandbox. Both refuse files in private datasets, which Microsoft can't fetch.
Privacy
Each preview loads Microsoft's viewer in the visitor's browser and gives Microsoft the document's address, from which Microsoft's servers fetch the document. The viewer loads only when scrolled into view, and is sent no more of your page's address than its origin.
Supported formats
By default, this plugin will attempt to preview the following formats:
"DOC", "DOCX", "XLS", "XLSX", "XLSB", "PPT", "PPTX", "PPS", "PPSX", "ODT", "ODS", "ODP"
The supported formats can be configured in your CKAN configuration file:
ckanext.officedocs.supported_formats = DOC DOCX XLS XLSX XLSB PPT PPTX PPS PPSX ODT ODS ODP
Formats are separated by spaces and matched case-insensitively. For example, to add macro-enabled Microsoft Office formats:
ckanext.officedocs.supported_formats = DOC DOCX DOCM XLS XLSX XLSM XLSB PPT PPTX PPTM PPS PPSX PPSM ODT ODS ODP
Private package fallback
Microsoft's online viewer can only render resources that are publicly reachable, so by default the previewer is not offered for resources in private datasets.
You can opt in to a client-side fallback for private resources:
ckanext.officedocs.enable_private_fallback = true
When enabled, private Office resources show a fallback panel instead of the online viewer:
- On a Chromium-based browser (Chrome, Edge, Brave, Opera), the panel offers an "Open document" link and suggests installing an Office viewer extension (Office or Office Editing for Docs, Sheets & Slides). With such an extension installed, opening the document renders it in the browser using the viewer's own session, which can reach the private resource.
- On other browsers (Firefox, Safari), the panel explains that previewing private files requires a Chromium-based browser with one of those extensions.
Note: browser extensions cannot be detected from a web page, so the fallback always shows the tip/link rather than auto-detecting whether an extension is present.
Viewer height
The height of the Office viewer iframe (used for public resources) is configurable:
ckanext.officedocs.iframe_height = 400px
Any valid CSS length is accepted (e.g. 600px, 75vh). Defaults to 400px.
Configuration reference
All options are declared via CKAN's config declaration, so you can inspect
them with ckan config declaration officedocs and validate your config with
ckan config validate.
| Option | Default | Description |
|---|---|---|
ckanext.officedocs.supported_formats |
DOC DOCX XLS XLSX XLSB PPT PPTX PPS PPSX ODT ODS ODP |
Space-separated formats to preview (case-insensitive). |
ckanext.officedocs.enable_private_fallback |
false |
Enable the Chromium fallback preview for private resources. |
ckanext.officedocs.iframe_height |
400px |
CSS height of the public-resource viewer iframe. |
Installation
To install ckanext-officedocs:
-
Clone this repository into the place where you normally install extensions, by default this will be /usr/lib/ckan/default/src/
-
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate -
Install the ckanext-officedocs Python package into your virtual environment:
cd ckanext-officedocs python setup.py install -
Add
officedocs_viewto theckan.pluginssetting in your CKAN config file (by default the config file is located at/etc/ckan/default/production.ini). -
If you wish for views to be created automatically for you, then you should add
officedocs_viewto the end of theckan.views.default_viewsoption in your config file.ckan.views.default_views = ... officedocs_view
-
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reloador if you're using
supervisor:sudo supervisorctl restart ckan-uwsgi:\*
FAQ
Q: It doesn't work, my documents aren't previewing
A: For the Microsoft online viewer to work, the documents to be previewed must be accessible to the wider internet (i.e. the Dataset Package is PUBLIC, not PRIVATE), and will only work if you use a hostname, and not just an IP address. To preview private resources, see the Private package fallback section above.
Metadata
Release files for ckanext-officedocs 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ckanext_officedocs-2.0.1.tar.gz | 23.1 kB | With provenance | Details for ckanext_officedocs-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ckanext_officedocs-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for ckanext_officedocs-2.0.1-py3-none-any.whl |
Total release size: 44.5 kB
Release files / ckanext_officedocs-2.0.1.tar.gz
| Download URL | ckanext_officedocs-2.0.1.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2936f0b945242817e86b6a5521ad9a39fafbc28167325156f6a29b60569277d0
|
|
BLAKE2b-256 checksum How to use checksums |
babb65e9ca316f66bdded47239f17d3dd0c169f6f5464503bbe2adabb8f5dfe2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logRelease files / ckanext_officedocs-2.0.1-py3-none-any.whl
| Download URL | ckanext_officedocs-2.0.1-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91d148e076e1bb47b3bc6f6c4ec11825766a313a125bbad5a2747dff8282ceda
|
|
BLAKE2b-256 checksum How to use checksums |
c7df9fe61234a40507da485e87fe2277ff11969e85f86e23eb77520b4cdcee26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logSecurity for ckanext-officedocs 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ckanext_officedocs-2.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.