Methods to automate magmi

Methods to automate magmi

August 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Methods to automate magmi

Title: Automating Magento Product Imports with Magmi CLI

Automating product imports is a crucial step for maintaining your e-commerce store’s inventory efficiently. In this post, we’ll guide you through automating the Magmi import process using its Command Line Interface (CLI). By the end of this tutorial, you will be able to schedule regular automated imports for your Magento store.

Setting Up Magmi CLI

Before embarking on automation, ensure that you have Magmi installed and properly configured in your Magento environment. If not, follow our comprehensive guide at Installing and Configuring Magmi to set up the foundation.

Understanding Magmi CLI Commands

Magmi provides a robust CLI that allows you to manage imports without intervention. The primary command for executing an import is:

php -f /path/to/magmi.php --mode=create --profile=default --engine=magmi_productimportengine:Magmi_ProductImportEngine --CSV:filename=/path/to/your/file.csv

Let’s break down the parameters:

  • --mode=create: This command mode prepares and runs the import.
  • --profile=default: Specifies the profile to use for the import. Ensure your default profile is configured with necessary settings like field mappings, data formats, etc.
  • --engine=magmi_productimportengine:Magmi_ProductImportEngine: Defines the engine used for processing the import file.
  • --CSV:filename=/path/to/your/file.csv: Specifies the CSV file to be imported.

Automating Magmi Imports

Automating Magmi imports involves creating a script that runs this command at scheduled intervals. Here’s a step-by-step guide:

1. Create an Automation Script

Create a PHP script (e.g., magmi_automation.php) in your Magento root folder and add the following content:

<?php
require 'app/Mage.php';
Mage::init();

$command = 'php /path/to/magmi/magmi.php --mode=create --profile=default --engine=magmi_productimportengine:Magmi_ProductImportEngine --CSV:filename=/path/to/your/file.csv';
exec($command);

echo "Magmi import completed successfully!\n";

Replace /path/to/magmi/ and /path/to/your/file.csv with appropriate paths on your server.

2. Scheduling the Automation Script

To automate the script, you can use a task scheduler like cron (Unix-based systems) or Task Scheduler (Windows). Here’s how to set up the schedule:

For Unix-based Systems (cron)

  • Open terminal and type crontab -e to edit your crontab file.
  • Add the following line at the end, replacing /path/to/magmi_automation.php with the actual path:
0 12 * * * /usr/bin/php5.6 /path/to/magmi_automation.php >/dev/null

This schedule runs the script daily at 12:00 PM.

For Windows (Task Scheduler)

  • Open Task Scheduler and click on “Create Basic Task”.
  • Name it something like “Magmi Import Automation” and click “Next”.
  • Choose “Daily” as the trigger and configure your preferred start time.
  • Click “Next”, then click “Start a program”.
  • Browse to C:\Program Files\PHP\v7.4\php.exe or wherever you have PHP installed.
  • Add /path/to/magmi_automation.php as an argument and click “Finish”.

Verifying the Automation

After setting up the schedule, the Magmi import should now run automatically at your specified time each day. You can verify this by checking the system logs or looking for the “Magmi import completed successfully!” message.

Remember to keep your Magmi profile and CSV file updated with relevant data to ensure a smooth automation process.

That’s it! By following these steps, you have successfully automated your Magento product imports using Magmi CLI. If you face any issues during the setup, feel free to explore our Magento Development Services for expert assistance in streamlining your e-commerce operations.

Happy automating!

Catalog Configuration Import/Export CLI

Our network