Supplier Price List Parser Bot (Excel/CSV/XML)

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Supplier Price List Parser Bot (Excel/CSV/XML)
Medium
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Price List Parser for Suppliers (Excel/CSV/XML)

Suppliers send price lists in different formats: Excel with non-standard structure, CSV with Cyrillic in various encodings, XML of varying standardization. Parser normalizes this into a unified format and syncs with store catalog.

Typical input file issues

  • Excel: data starts on row 3, headers in merged cells
  • CSV: windows-1251 encoding, semicolon delimiter, prices with spaces
  • XML: non-standard tags, namespaces, attributes instead of values
  • Inconsistent SKU formats across suppliers
  • Numbers as strings, dates as Excel numbers

Excel Parser (PhpSpreadsheet)

// app/Services/PriceList/ExcelParser.php
class ExcelParser {
    public function parse(string $filePath, array $config): array {
        $spreadsheet = IOFactory::load($filePath);
        $sheet = $spreadsheet->getActiveSheet();

        $this->detectColumns($sheet, $config['header_row'] ?? 1, $config['column_aliases']);

        $products = [];
        for ($row = $config['data_start_row'] ?? 2; $row <= $sheet->getHighestRow(); $row++) {
            $sku = $this->getCellValue($sheet, $this->columnMap['sku'], $row);
            if (empty($sku)) continue;

            $products[] = [
                'sku'   => trim($sku),
                'name'  => $this->getCellValue($sheet, $this->columnMap['name'] ?? null, $row),
                'price' => $this->parsePrice($this->getCellValue($sheet, $this->columnMap['price'], $row)),
                'stock' => $this->parseStock($this->getCellValue($sheet, $this->columnMap['stock'] ?? null, $row)),
            ];
        }

        return $products;
    }
}

CSV Parser with encoding detection

// app/Services/PriceList/CsvParser.php
class CsvParser {
    public function parse(string $filePath, array $config = []): array {
        $content = file_get_contents($filePath);

        // Auto-detect encoding
        $encoding = mb_detect_encoding($content, ['UTF-8', 'Windows-1251', 'KOI8-R'], true);
        if ($encoding && $encoding !== 'UTF-8') {
            $content = mb_convert_encoding($content, 'UTF-8', $encoding);
        }

        // Auto-detect delimiter
        $delimiter = $config['delimiter'] ?? $this->detectDelimiter($content);

        $lines = str_getcsv($content, "\n");
        $headers = str_getcsv(array_shift($lines), $delimiter);

        $products = [];
        foreach ($lines as $line) {
            if (empty(trim($line))) continue;
            $row = str_getcsv($line, $delimiter);
            $data = array_combine($headers, $row);
            $products[] = $this->normalizeRow($data, $config);
        }

        return $products;
    }
}

XML Parser

// app/Services/PriceList/XmlParser.php
class XmlParser {
    public function parse(string $filePath, array $config): array {
        $xml = simplexml_load_file($filePath, 'SimpleXMLElement', LIBXML_NOCDATA);

        $itemXpath = $config['item_xpath'] ?? '//item';
        $items = $xml->xpath($itemXpath);

        return array_map(fn($item) => $this->extractItem($item, $config), $items);
    }

    private function extractItem(\SimpleXMLElement $item, array $config): array {
        $fields = $config['fields'] ?? [];

        return [
            'sku'   => (string) $item->xpath($fields['sku'] ?? 'article')[0] ?? '',
            'name'  => (string) $item->xpath($fields['name'] ?? 'name')[0] ?? '',
            'price' => (float) ($item->xpath($fields['price'] ?? 'price')[0] ?? 0),
            'stock' => ((string) ($item->xpath($fields['stock'] ?? 'available')[0] ?? '1')) !== '0',
        ];
    }
}

Automatic file fetching

Price lists arrive via email, FTP, or HTTP:

// app/Jobs/FetchSupplierPriceList.php
class FetchSupplierPriceList implements ShouldQueue {
    public function handle(PriceListFetcher $fetcher, PriceListParser $parser): void {
        $supplier = Supplier::findOrFail($this->supplierId);

        $filePath = match ($supplier->price_list_source) {
            'ftp'   => $fetcher->downloadFromFtp($supplier),
            'url'   => $fetcher->downloadFromUrl($supplier->price_list_url),
            'email' => $fetcher->fetchFromEmail($supplier),
        };

        $config = config("price_list_parsers.{$supplier->config_key}");
        $products = $parser->parse($filePath, $config);

        foreach (array_chunk($products, 500) as $chunk) {
            ImportPriceListChunk::dispatch($supplier->id, $chunk);
        }
    }
}

Development timeline

Single supplier parser (1 format, standard structure): 2-4 business days. Universal dispatcher + 5 suppliers with different formats: 7-10 business days.