Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 2.57 KB

File metadata and controls

74 lines (59 loc) · 2.57 KB

OpenProject CSV Importer

Overview

This Python script automates the import of tasks (work packages) into a self-hosted OpenProject instance using the OpenProject REST API (v3). It reads a CSV file containing task details and posts them into the specified OpenProject project.

Key features:

  • Reads any user-provided CSV file containing Subject, Description, Status, and Priority columns.
  • Authenticates using OpenProject API tokens (passed as Basic Auth with username apikey).
  • Loops through all CSV rows and creates work packages (usually of type Task).
  • Provides basic error checking and API connectivity validation.

Requirements

  • Python 3.7 or higher
  • Python packages:
    • requests
    • pandas

These can be installed with:

pip install requests pandas

Script Functionality

  • Prompts the user for:
    • OpenProject URL (e.g., http://openproject.local)
    • OpenProject API token (generated from your user account page)
    • Numeric Project ID (e.g., 3)
    • Full path to the CSV file (e.g., D:/path/to/progress_import_ready.csv)
  • Checks if the CSV file exists and loads it.
  • Validates the API token by making a test GET request.
  • Iterates over each row and posts a new work package via the API.
  • Prints success or failure messages for each imported item.

Example CSV Format

Your CSV should include at least the following columns:

  • Subject
  • Description
  • Status (e.g., "New", "In Progress", "Closed")
  • Priority (e.g., "Normal", "High", "Low")

How to Build an Executable

To run this in an air-gapped environment as a standalone executable:

1️ Install PyInstaller (on a machine with internet access):

pip install pyinstaller

2️ Build the executable:

pyinstaller --onefile --name openproject_importer import_script.py

3️ After building, locate the generated executable inside the dist/ folder:

dist/openproject_importer.exe

4️ Transfer the executable and the CSV file to the air-gapped system.

5️ Run the executable:

openproject_importer.exe

6️ Follow the prompts to enter your OpenProject connection details and import tasks.

Notes

  • The script relies on the OpenProject REST API v3.
  • API token authentication uses the apikey user name (per OpenProject documentation).
  • Make sure the target OpenProject project allows API access and that the token has sufficient permissions.
  • If needed, adjust the type value in the script (default is 1 for Task).

For enhancements (such as better error handling, additional field mappings, or logging), feel free to contact or extend the script!