npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

directus-extension-endpoint-xlsx-export

v0.1.0

Published

Export collection items as XLSX files.

Readme

directus-extension-endpoint-xlsx-export

Export Directus collection items as real XLSX files through a custom endpoint.

This package exposes a fixed endpoint root:

/xlsx/:collection

Example:

/xlsx/aulas?filter[id][_eq]=18

Features

  • Exposes a stable endpoint root: /xlsx
  • Uses real XLSX output, not CSV renamed as XLSX
  • Forwards native Directus query parameters such as filter, fields, sort, limit, offset, page, search, deep, and alias
  • Defaults limit to -1 when omitted, so exports include all matching rows
  • Converts nested arrays and objects to JSON strings so spreadsheets open cleanly
  • Supports optional filename and sheet query parameters

Requirements

  • Directus 11.x
  • A self-hosted Directus project
  • Node.js and npm for local development

Route

GET /xlsx/:collection

Query Parameters

All standard Directus query parameters are forwarded to ItemsService.readByQuery().

Additional custom query parameters:

  • filename: overrides the downloaded file name
  • sheet: overrides the worksheet name

Examples:

/xlsx/aulas?filter[id][_eq]=18
/xlsx/posts?fields=id,title,status&sort=-date_created
/xlsx/orders?filter[status][_eq]=paid&filename=paid-orders
/xlsx/users?limit=50&sheet=Users

Build

npm install
npm run build

Build output will be written to:

dist/index.js

Local Installation in a Directus Project

Build the extension first:

npm install
npm run build

Then copy the built package into your Directus extensions directory:

mkdir -p /path/to/directus/extensions/directus-extension-endpoint-xlsx-export
cp -R dist package.json README.md LICENSE /path/to/directus/extensions/directus-extension-endpoint-xlsx-export/

Restart Directus.

If your Directus project is running in Docker and mounts ./extensions:/directus/extensions, copy the built package into that mounted local extensions directory.

Installation from npm in a Custom Directus Image

After publishing this package to npm, install it in your custom Directus image.

Example Dockerfile:

FROM directus/directus:latest

USER root
RUN corepack enable
USER node

RUN pnpm install directus-extension-endpoint-xlsx-export

Then rebuild and restart your Directus stack:

docker compose build
docker compose up -d

Development with Auto Reload

If you are mounting a local extensions directory into Directus, enable auto reload in your Directus container environment:

EXTENSIONS_AUTO_RELOAD: true

Then run:

npm install
npm run dev

Usage

Export a Single Item by ID

/xlsx/aulas?filter[id][_eq]=18

Export Selected Fields

/xlsx/aulas?filter[id][_eq]=18&fields=id,titulo,data

Custom File Name

/xlsx/aulas?filter[id][_eq]=18&filename=aula-18

Custom Sheet Name

/xlsx/aulas?filter[id][_eq]=18&sheet=Aula%2018

Publish to npm

Before publishing:

npm install
npm run build
npm pack --dry-run

Then publish:

npm publish

If you change to a scoped package name, publish it as public:

npm publish --access public

Notes

  • The public endpoint root is controlled by id: "xlsx" in src/index.ts
  • You can change the npm package name without changing the public route
  • If the exact npm package name is already taken, only change package.json.name
  • Large exports can still be capped by Directus QUERY_LIMIT_MAX
  • This package provides an API endpoint only. It does not add a Directus UI button