A tool for importing and processing financial data from various sources into Business Central.
Power Importer is a Python-based tool designed to streamline the process of importing financial data from various sources into Microsoft Dynamics 365 Business Central. It handles character encoding conversion, CSV to JSON transformation, currency conversion, and API integration with Business Central.
- Character Encoding Conversion: Convert files between different character encodings, particularly useful for handling Japanese text.
- CSV to JSON Transformation: Convert CSV files to JSON format for API consumption.
- Currency Conversion: Handle currency conversion between different currencies using exchange rate APIs.
- Business Central API Integration: Post journal entries to Business Central via its API.
- Error Handling: Robust error handling and reporting for failed operations.
- Logging: Comprehensive logging for debugging and auditing.
Power-importer/
├── core/ # Core functionality scripts
│ ├── api/ # API client modules
│ ├── converters/ # Data conversion modules
│ ├── currency/ # Currency-related modules
│ ├── charset_converter.py # Converts files between different character encodings
│ ├── csv_to_json_converter.py # Converts CSV files to JSON format
│ ├── currency_converter.py # Handles currency conversion
│ ├── exchange_rate_api.py # API client for exchange rate services
│ ├── exchange_rate_query.py # Queries exchange rates
│ └── process_japan_exports.py # Processes export data from Japan
│
├── utils/ # Utility functions
│ ├── company_currency_mapping.py # Maps companies to their currencies
│ ├── config.py # Centralized configuration settings
│ ├── env_config.py # Environment configuration handling
│ ├── oauth_token_helper.py # OAuth token management
│ └── update_imports.py # Script to update import statements
│
├── docs/ # Documentation
│ ├── deployment_guide.md # Guide for deploying the system
│ ├── migration_guide.md # Guide for migrating to the new structure
│ └── project_structure.md # Overview of the project structure
│
├── examples/ # Example data and files
│
├── Temp/ # Temporary files and test code
│ ├── data/ # Data files
│ ├── tests/ # Test scripts
│ └── rate_table/ # Rate table files (POC)
│
├── .env.example # Example environment variables
├── .gitignore # Git ignore file
├── migrate.bat # Windows migration script
├── migrate.sh # Linux/macOS migration script
├── README.md # Project README
├── requirements.txt # Python dependencies
├── run_importer.py # Main entry point
└── setup.py # Package setup script
For more details, see docs/project_structure.md.
- Python 3.8 or higher
- Git
- Access to Business Central API
- Exchange Rate API key (if using currency conversion)
-
Clone the repository:
git clone https://github.com/your-organization/power-importer.git cd power-importer
-
Create a virtual environment:
# On Linux/macOS python -m venv venv source venv/bin/activate # On Windows python -m venv venv venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Install the package in development mode:
pip install -e .
-
Create a
.env
file:cp .env.example .env
-
Edit the
.env
file with your configuration.
For detailed installation instructions, see docs/deployment_guide.md.
# Show help
python run_importer.py --help
# Basic usage
python run_importer.py "input.csv"
# Specify output JSON file
python run_importer.py "input.csv" --output-json "output.json"
# Skip importing to ERP
python run_importer.py "input.csv" --skip-import
# Dry run (generate report only without posting to API)
python run_importer.py "input.csv" --dry-run
If you've installed the Power Importer as a package, you can use the power-importer
command:
# Show help
power-importer --help
# Basic usage
power-importer "input.csv"
For more usage options, see docs/deployment_guide.md.
If you're migrating from the old project structure, use the migration scripts:
# On Linux/macOS
./migrate.sh
# On Windows
migrate.bat
For detailed migration instructions, see docs/migration_guide.md.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.