cds-spreadsheetimporter-plugin
A CAP plugin that adds an ImporterService accepting an uploaded Excel file, parses it on the server and writes its rows into the CDS entity named in the URL.
Adds an ImporterService to a CAP project whose Spreadsheet entity accepts an Excel file by PUT at /odata/v4/importer/Spreadsheet(entity='...')/content, parses it in the service and writes the rows into the entity named in the URL. The whole file goes to the backend rather than being read in the browser, which the documentation gives as the reason to reach for it on large files. By default every entity is a valid target; annotating any service entity with @spreadsheetimporter.enabled turns that into an allow-list and every other entity is refused with 403 SPREADSHEET_IMPORT_ENTITY_NOT_ENABLED, and annotating a projection also enables the persistence entity behind it. That annotation chooses targets and nothing else — who may upload is still CAP's own @requires and @restrict on the importer service. It pairs with the ui5-cc-spreadsheetimporter UI5 component through its directUploadConfig option, and a plain FileUploader posting to the same endpoint works as well.
Facts
Where it sits
Who is behind it
In the atlas: maintains 25, contributes to 39, wrote 12@lemaiwoMarian ZeisMarian ZeisMaintains this
In the atlas: maintains 35, contributes to 86, wrote 25@marianfooSpreadsheet ImporterSpreadsheet ImporterMaintains this
In the atlas: maintains 9@spreadsheetimportermaintainers
Before choosing this
Conditions
LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
- § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
- § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
- § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
Also, from Importing and exporting table data§ 1: The export side can become the data-extraction case named in section 1. File format alone does not decide it; destination, scale and the scoped interoperability purpose matter.
What it declares
Every artifact
- Type
- CDS plugin
- Origin
- By a community org
- Runtime
- Node.js
As a CDS plugin
- Declared for
- >=7
- Distributed through
- does not say
Connections
Getting files into tables and table content back out as files
Download
Install
npm add cds-spreadsheetimporter-pluginDerived from the package name. No recipe recorded; the README has the configuration.
Learn more
- Create your first CAP pluginCreate your first CAP pluginA step-by-step guide to the cds-plugin.js extension point: scaffold a package, add an index.cds for shared model artifacts, and test it locally against a throwaway CAP project before publishing to npm, with a separate section on building the same plugin in TypeScript and compiling it with tsc. Points to the author's own cds-plugin-handlers and ui5-cap-serverside-rendering-plugin as worked examples.published 2024-12-09Wouter Lemaire, SAP Community
README
quoted from spreadsheetimporter/cds-spreadsheetimporter-plugin under ISC, readcds-spreadsheetimporter-plugin
This is a plugin for the CAP framework that allows you to import data from spreadsheets into your CAP project.
Enable Import for Selected Entities
By default, the importer keeps the existing behavior and allows uploads for all entities. To limit uploads to selected entities, annotate the allowed service entities with @spreadsheetimporter.enabled in your CDS model:
using my.bookshop as my from '../db/schema';
using from 'cds-spreadsheetimporter-plugin';
service CatalogService {
@spreadsheetimporter.enabled
entity Books as projection on my.Books;
entity Authors as projection on my.Authors;
}
When at least one entity is annotated, the importer rejects uploads for every other entity with 403 SPREADSHEET_IMPORT_ENTITY_NOT_ENABLED. Annotating a service projection also enables uploads for its underlying persistence entity, so existing URLs such as /odata/v4/importer/Spreadsheet(entity='my.bookshop.Books')/content keep working. Short entity names resolved by CAP, such as Books, are supported as well.
Use this annotation only to control which entities the importer may target. For user or role-based authorization, continue to use CAP authorization annotations such as @requires or @restrict on the importer service or your application services. For example:
annotate ImporterService with @requires: 'Admin';
Release Process
This project uses release-it to automate version management and package publishing. The release workflow is configured through GitHub Actions and can be triggered in two ways:
Manual Release
- Go to the GitHub repository's "Actions" tab
- Select the "Release" workflow
- Click "Run workflow"
- You can either:
- Leave the version field empty for automatic versioning based on conventional commits
- Specify a specific version (e.g., "1.2.0")
Local Release (for maintainers)
If you prefer to release from your local machine:
- Ensure you have the necessary credentials:
NPM_TOKENfor publishing to npmGITHUB_TOKENfor creating GitHub releases
- Run one of the following commands:
npm run release # For automatic versioning npm run release X.Y.Z # For specific version
What happens during release?
The release process will:
- Determine the next version number (based on conventional commits or manual input)
- Update the package.json version
- Generate/update the CHANGELOG.md file
- Create a git tag
- Push changes to GitHub
- Create a GitHub release with release notes
- Publish the package to npm
The release configuration uses the Angular conventional commit preset for changelog generation and requires commit messages to follow the conventional commits specification.
History
Features 1
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
History in the atlas
- First seen.
For your agent
- Ref
artifact:spreadsheetimporter-cds-spreadsheetimporter-plugin- JSON
- /artifacts/spreadsheetimporter-cds-spreadsheetimporter-plugin.json
- MCP
- Connecting an agent