Automated Excel Order Import for Bitrix

Wholesale buyers work with their price lists and specifications in Excel. They want to take a ready-made table of "SKU — quantity", upload it to the site, and immediately get a cart. Without this feature, a manager wastes an hour on manual entry. They make mistakes. The client leaves for a competito

Our competencies:

Frequently Asked Questions

Wholesale buyers work with their price lists and specifications in Excel. They want to take a ready-made table of "SKU — quantity", upload it to the site, and immediately get a cart. Without this feature, a manager wastes an hour on manual entry. They make mistakes. The client leaves for a competitor with a more convenient site. Standard Bitrix does not include tools for reading Excel. A custom implementation is required. Our solution is a turnkey module for loading orders from Excel. It is adapted to your business processes and file formats. This eliminates routine work. It cuts operating costs by tens of thousands of rubles monthly. It reduces the load on managers.

Overview

The loading process consists of several stages: server-side file parsing, header detection, SKU resolution, and adding to the cart. Let's examine each step with real code.

How to Use

  1. Upload your Excel file (.xlsx or .xls) through the interface.
  2. The system automatically detects columns using keywords like SKU and quantity.
  3. Preview the parsed items. You can edit quantities and remove unmatched rows.
  4. Click “Add to cart”. All found products are added instantly.
  5. Review your cart and proceed to checkout.

This simple workflow enables automatic Excel upload to website. It turns a manual task into a one-click process.

Technical Implementation

Parsing Excel on the Server

To read .xlsx files, we use the PhpSpreadsheet library (successor to PHPExcel). It is installed via Composer:

composer require phpoffice/phpspreadsheet 

AJAX controller for file processing:

public function uploadAction(): array { $file = $_FILES['excel_file']; if (!$file || $file['error'] !== UPLOAD_ERR_OK) { return ['status' => 'error', 'message' => 'File not uploaded']; } $allowedMimes = [ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel', ]; if (!in_array($file['type'], $allowedMimes)) { return ['status' => 'error', 'message' => 'Invalid file format']; } $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createAutomatic( \PhpOffice\PhpSpreadsheet\IOFactory::identify($file['tmp_name']) ); $spreadsheet = $reader->load($file['tmp_name']); $sheet = $spreadsheet->getActiveSheet(); $rows = $sheet->toArray(); return $this->processRows($rows); } 

Row parsing logic detects headers by keywords like 'sku', 'article', 'qty'. If not found, defaults assume column 0 = SKU, column 1 = quantity.

Full header detector code This method iterates over rows, looks for cells with keywords ('sku', 'article', 'qty', etc.) and determines column positions. If no header is detected, it falls back to assuming first column is SKU and second is quantity.

SKU Resolution and Batch Performance

After parsing, we have an array of SKUs. We resolve them with a single batch SQL query. This is much faster than N separate queries:

private function resolveArticles(array $items): array { $articles = array_column($items, 'article'); // Search in SKU property of offers $placeholders = implode(',', array_fill(0, count($articles), '?')); $rs = $connection->query( "SELECT ie.ID, iep.VALUE AS ARTICLE, ie.IBLOCK_ELEMENT_ID AS PRODUCT_ID FROM b_iblock_element ie JOIN b_iblock_element_property iep ON iep.IBLOCK_ELEMENT_ID = ie.ID WHERE iep.IBLOCK_PROPERTY_ID = ? AND iep.VALUE IN ($placeholders)", array_merge([$articlePropertyId], $articles) ); // ... } 

Batch query performance: When importing 1000 rows, executing 1000 separate SELECT queries creates enormous database load. A single WHERE IN reduces resolution time from tens of seconds to fractions of a second. In our projects, this yields a 10–15x speedup on catalogs starting from 10,000 items.

Preview and Cart Integration

After file upload, the user sees a table with results:

SKU from file Found product Qty Price Status
ABC-123 Bolt M8×20 100 $2.50 Found
XYZ-999 5 Not found
DEF-456 Nut M8 50 $1.20 Out of stock

The client can adjust quantities. They can remove unmatched items. They click "Add to cart". Adding is again a batch operation using \Bitrix\Sale\Basket. An Excel template is available for download to ensure correct column headers.

Case Study: Building Materials Distributor

Situation: 300+ corporate clients, each with their own order table. Managers spent 2–3 hours per day manually entering items.

Implementation:

  • Format detector: recognizes 7 header variants (SKU, article, code, item, etc.)
  • Supports .xlsx and .xls (via PhpSpreadsheet)
  • Limit: max 1,000 rows per upload, file size up to 5 MB
  • Preview with editable quantity
  • Automatic matching by XML_ID if SKU is not found in the property

Result: managers freed up 2+ hours per day. Clients place orders independently. Savings: order processing costs reduced by up to 70%. The entire functionality was implemented in 8 working days.

Stage Duration
Setting up PhpSpreadsheet, file upload 1 day
Parser with header detector 2 days
SKU resolution, batch query 1 day
Preview table with editing 2 days
Batch add to cart 1 day
Testing on real client files 1 day

Deliverables and Special Cases

What's Included

  • File uploader for .xlsx/.xls with format validation
  • Parser with auto-detection of headers and column positions
  • Batch SKU resolution via b_iblock_element_property
  • Preview of results with correction option before adding to cart
  • Batch addition of found products to cart using \Bitrix\Sale\Basket
  • Excel template for download
  • Full technical documentation
  • Server access and deployment instructions
  • Training session for managers (up to 2 hours)
  • Post-launch support for 30 days

Special Cases: Custom Parser Needed

If your clients send files with non-standard structure — floating headers, different encodings, or extra columns — the standard Bitrix import won't handle it. Only a custom parser with format detection ensures correct loading. This is where our custom Excel parser expertise shines.

Why Choose Us

We have specialized in Bitrix for over 10 years. We have implemented dozens of Excel integrations for wholesale orders. Our solutions undergo load testing on catalogs up to 100,000 items. We guarantee stable operation and post-implementation support. With 10+ years of experience and a proven track record of successful projects, we deliver robust, scalable solutions.

We will evaluate your project within one business day. Contact us to discuss details. We will prepare a commercial proposal with accurate timelines and cost. Order the development of the module. We will prepare an estimate within a day.