notion-for-each-row

1.0.2 • Public • Published

notion-for-each-row

npm install --save notion-for-each-row

For each row in a Notion database, run a JavaScript function. Paginates so you don't have to.

Example

see examples/main.js for implementation

const forEachRow = require("notion-for-each-row");

forEachRow(
  {
    token: process.env.NOTION_TOKEN,
    database: process.env.NOTION_DATABASE_ID,
    sorts: [
      {
        property: "Next Birthday",
        direction: "ascending",
      },
    ],
  },
  (row) => {
    console.log({
      name: row.properties.Name.title,
      birthday: row.properties["Next Birthday"].formula.date.start,
    });
  }
);

// => { name: 'Ada', birthday: '2021-12-10' }
// => { name: 'Alan', birthday: '2022-06-23' }
// => { name: 'Me', birthday: '2022-07-20' }

Readme

Keywords

Package Sidebar

Install

npm i notion-for-each-row

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

2.82 kB

Total Files

5

Last publish

Collaborators

  • prezjordan