This is a Node.js project designed to fetch data from a Notion database and update or append the data to a Google Sheets document. It uses the Notion and Google Sheets APIs to perform these actions.
- Fetch data from Notion databases.
- Update or append rows to a Google Sheets document based on the data received from Notion.
- Node.js installed on your machine.
- A Notion account and a database from which data will be fetched.
- A Google account and a Google Sheets document to which the data will be written.
- Google Service Account with the necessary permissions to edit the Google Sheets document.
- Notion internal integration token.
- Clone the repository.
$ git clone https://github.com/caiotarifa/notion2sheets.git
- Install the dependencies.
$ cd notion2sheets
$ npm install
- Rename
.env.example
to.env
and replace the placeholder text with your Google Service Account and Notion internal integration token.
GOOGLE_SERVICE_ACCOUNT=your-google-service-account
NOTION_TOKEN=your-notion-token
- Rename
collections.toml.example
file tocollections.toml
and replace the collections array with your own data.
[[collections]]
notionDatabaseId = "your-notion-database-id"
googleSheetId = "your-google-sheet-id"
googleSheetName = "your-google-sheet-name"
- Run the script.
$ node main.js
The script will fetch data from the specified Notion database and update or append the data to the specified Google Sheets document.
Contributions to the project are welcome. If you want to contribute to the project, follow these steps:
- Fork the project.
- Create your feature branch (
git checkout -b feature/feature-name
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/feature-name
). - Open a pull request.
- Please make sure to update tests as appropriate.
Distributed under the MIT License. See LICENSE for more information.