Macro for Excel or another script for editing XML without changing the structure
Task:
There is an XML file (export of the product catalog from the website).
It is necessary to implement a solution that will allow mass updating of data in this XML (prices and availability statuses of products) without breaking its structure.
What needs to be implemented:
A script / macro / program that:
opens the XML;
finds the required products by article number or other reference (similar to VLOOKUP);
updates the target value (for example, price or availability) according to the Excel file;
saves the result in the same form, without breaking the XML structure.
The solution should be easy to use (for example, running a macro from Excel, or running a Python script with a double click (.exe)).
As a result, we get a ready-to-use current XML file that can be placed on hosting and distributed via a link.
Desirable:
Implementation in VBA (Excel), but a solution in Python or another language can also be proposed if it is more reliable / simpler and more convenient.
A short user guide.
Submission format:
A ready working file (Excel with a macro, or script).
An example of the updated XML.
Instructions (how to update the data).
Task:
There is an XML file (export of the product catalog from the website, with nodes <offer>).
It is necessary to implement a solution that allows for bulk editing of data in this XML (prices, availability statuses, names, descriptions, photos, etc.) without violating the structure of the file.
The output should be an updated XML that can be uploaded to hosting and distributed via a link.
Input Data
XML file.
One product is located between
<offer>…</offer>.Product identification is done by one of the nodes (for example,
<vendorCode>), but there should be an option to manually specify which node to identify by, meaning it does not always have to be byvendorCode.Some data is stored in nodes (for example,
<description>,<price>), while others are in the form of attributes (available="true|false"in<offer>).There are lists of nodes (for example,
<picture>) that can contain any number of elements (several photos for a product, accordingly there are also several<picture>nodes).
Excel file with "instructions" for updating.
Minimum structure:Identifier (for example vendorCode) New value (name of the node, attribute, or indication that the photo needs to be updated, in the case of photos) 12345 true 67890 false Additionally:
For nodes of type
<picture>, it is allowed to specify a list of values in the formaturl1;url2;url3. The program should convert this into a set of nodes:<picture>url1</picture>
<picture>url2</picture>
<picture>url3</picture>
For other nodes or attributes — the new value is recorded directly in the second column.
For the scenario of adding new nodes: a complete node can be passed in the second column (for example
<wholesalePrice>100</wholesalePrice>), accordingly this node will need to be added to the required product.
Functionality
The solution must provide:
Reading the XML file.
Searching for the required products in the file by identifier (for example, by
<vendorCode>).Updating values according to the Excel table:
Replacing attributes (for example,
available="true/false").Replacing nodes (
<price>,<description>,<name>, etc.).Replacing list nodes (
<picture>).For any scenario - it is sufficient to completely replace old data with new ones. Old data does not need to be retained.
Additional scenario (optional): the ability to bulk add new nodes in
<offer>(for example<wholesalePrice>).Saving the result in a new XML file:
The structure must remain unchanged.
Solution Format
Possible implementation options:
Excel + VBA (macro):
Table with instructions in Excel.
Button to run the macro that reads the XML and performs the update.
Result — new XML file.
Python (or another language) + .exe:
Separate script/program that takes XML + Excel with instructions.
Run by double-clicking.
Result — new XML file in the same folder.
Usage Requirements
Ease of use for non-technical users.
Short user guide:
Prepare Excel with instructions (identifier + new value).
Run the script/macro.
Receive updated XML.
Editing Scenarios
Updating attributes (for example
available="true|false").Updating value in a node (for example
<price>,<description>).Updating list nodes (for example
<picture>). Old elements are removed, new ones are added.(Optional) Adding new nodes to the product.
Submission Format
Ready working file (Excel with macro or .exe/script).
Example of updated XML after changes.
User instructions (how to run, how to prepare Excel).
Задача:
Є XML-файл (вигрузка каталогу товарів з сайту, з вузлами <offer>).
Потрібно реалізувати рішення, яке дозволить масово редагувати дані у цьому XML (ціни, статуси наявності, назви, описи, фото, тощо) без порушення структури файлу.
На виході — оновлений XML, який можна викласти на хостинг і роздавати по посиланню.
Вхідні дані
XML-файл.
Один товар знаходиться між
<offer>…</offer>.Ідентифікація товарів здійснюється по одному з вузлів (наприклад,
<vendorCode>), але потрібна можливість вручну вказувати по якому з вузлів ідентифікуємо, тобто не завжди це має відбуватись саме поvendorCode.Деякі дані зберігаються у вузлах (наприклад,
<description>,<price>), а деякі у вигляді атрибутів (available="true|false"у<offer>).Є списки вузли (наприклад,
<picture>), які можуть містити довільну кількість елементів (декілька фото у товару, відповідно і вузлів<picture>теж декілька.
Excel-файл із "інструкцією" для оновлення.
Мінімальна структура:Ідентифікатор (наприклад vendorCode) Нове значення (назва вузла, атрибуту, чи вказівка, що оновити треба фото, для випадку з фото) 12345 true 67890 false Додатково:
Для вузлів типу
<picture>допускається вказувати список значень у форматіurl1;url2;url3. Програма має перетворювати це у набір вузлів:<picture>url1</picture>
<picture>url2</picture>
<picture>url3</picture>
Для інших вузлів або атрибутів — у другому стовпчику записується нове значення напряму.
Для сценарію з додаванням нових вузлів: у другому стовпчику може бути переданий повний вузол (наприклад
<wholesalePrice>100</wholesalePrice>), відповідно потрібно буде додати цей вузол до потрібного товару.
Функціонал
Рішення повинно забезпечувати:
Зчитування XML-файлу.
Пошук потрібних товарів у файлі за ідентифікатором (наприклад, по
<vendorCode>).Оновлення значень згідно з Excel-таблицею:
Заміна атрибутів (наприклад,
available="true/false").Заміна вузлів (
<price>,<description>,<name>і т.д.).Заміна спискових вузлів (
<picture>).Для будь-якого сценарію - достатньо повністю замінити старі дані новими. Старі дані зберігати не потрібно.
Додатковий сценарій (опціонально): можливість масово додавати нові вузли в
<offer>(наприклад<wholesalePrice>).Збереження результату у новий XML-файл:
Структура повинна залишитися незмінною.
Формат рішення
Можливі варіанти реалізації:
Excel + VBA (макрос):
Таблиця з інструкцією в Excel.
Кнопка запуску макросу, який читає XML і виконує оновлення.
Результат — новий XML-файл.
Python (або інша мова) + .exe:
Окремий скрипт/програма, яка бере XML + Excel з інструкцією.
Запуск подвійним кліком.
Результат — новий XML-файл у тій самій папці.
Вимоги до використання
Простота запуску для не технічних користувачів.
Коротка інструкція по роботі:
Підготувати Excel з інструкціями (ідентифікатор + нове значення).
Запустити скрипт/макрос.
Отримати оновлений XML.
Сценарії редагування
Оновлення атрибутів (наприклад
available="true|false").Оновлення значення у вузлі (наприклад
<price>,<description>).Оновлення спискових вузлів (наприклад
<picture>). Старі елементи видаляються, додаються нові.(Опціонально) Додавання нових вузлів у товар.
Формат здачі роботи
Готовий робочий файл (Excel з макросом або .exe/скрипт).
Приклад оновленого XML після змін.
Інструкція для користувачів (як запускати, як готувати Excel).
Client's review of cooperation with Anton T.
Macro for Excel or another script for editing XML without changing the structureQuality execution, loyal approach, satisfied with the result and the process of cooperation. The task has been solved, all nuances taken into account. Anton provided assistance in testing the script and explaining its functionality (both separately and in the form of a text manual) + helped to consider the pitfalls that could arise in the future.
Freelancer's review of cooperation with Artem Prom
Macro for Excel or another script for editing XML without changing the structureThe client promptly clarified some points, checked implementation options, and successfully closed the project.
-
Using a VBA macro is very inconvenient for building XML structure and editing data because for VBA, XML is just a text file with indentation.
I can implement it in Python. I already have a ready script that forms the XML structure for promo. I can easily add editing through Excel.
It will work approximately like this: you run a script that reads the XML and forms an Excel table. In this table, you change the data and run the script that will change this data in the XML.
This will be the simplest and fastest solution to your task.
p.s. with the help of a Python script, you can automatically update prices and availability from Google Sheets and immediately upload them to hosting for distribution via a link. You won't need to do this manually.
-
Hello, I worked on the project "XML Analysis for the Store" – updated 1200 products, automated price changes and availability status while preserving the file structure.
What format of the Excel file do you plan to use for the updates – with product codes in a separate column?
I suggest we get in touch, I will consult you for free on the technical side and we will create a development plan + I will tell you about my team!
-
1449 24 3 Hello.
I have experience in completing similar tasks, so I am confident that I can deliver everything with quality and within the agreed deadlines. I am ready to start soon. Let's discuss the details in private messages.
-
151 Good day.
I can implement it in VBA. I have a few questions?
1. I need an example of the xml file
2. Where to get the new prices? I also need an example.
The final price and deadline after discussion.
-
669 8 0 Hello
I have experience writing similar scripts in Python. I can develop such a program for you as well. I will provide a video instruction on how to use the program.
-
4028 11 0 2 Hello. Technologies: lxml (correct structure preservation), pandas (reading Excel), PyInstaller (build into .exe).
Interface: simple window launcher or console with prompts (choose XML, Excel, columns SKU/price/status).
Advantages: quickly processes large XML (tens to hundreds of MB), stability, easy expansion.
-
232 1 0 Hello, Artem!
I am a Python developer with experience working with Excel and XML files.
I can write a simple script that will replace the values you need without disrupting the file structure.
Write to me, and we will discuss your project!
Best regards,
Andriy
-
1470 6 0 1 We can create both an .EXE file and a web solution for cross-platform access. We have extensive experience in similar projects.
-
986 12 1 Ready to implement a solution for bulk updating an XML product catalog.
Option 1 — Excel + macro (VBA): I will create a macro that:
opens the XML file;
finds products by SKU (similar to VLOOKUP);
updates prices and stock statuses from the Excel table;
saves the XML without breaking the structure.
Output: a ready Excel file with a launch button, instructions, an example of the updated XML.
If the XML format is complex — I will suggest an alternative in Python:
a script that reads Excel, updates XML, and saves the result;
… I can compile it into .exe for double-click execution.
The solution will be easy to use, with instructions for the team. I am ready to adapt to your XML format.
-
2211 18 3 Good evening, Artem. I am working on automation in Python. I can develop a Python script and package it as an exe file for your needs, I will do everything quickly and efficiently. If you are interested - write to me, I will be happy to discuss the details.
-
2947 73 4 2 Hello! I can write such a script, as I have a very large experience working with ET Excel (more than 20 years!!!! Contact me!!!!!
-
4461 102 0 Good evening. I will be happy to help. Can you send an example of the files?
-
97 34 4 2 The technical task is clear
I will do it today
I can create a .exe file for Windows or a .app for macOS
-
8185 381 0 1 Hello. I am interested in your project. I am ready to discuss and execute it in the form of a program (exe).
-
5878 345 0 I will review the XML file and propose an implementation for changing prices/statuses.
-
656 9 0 Good evening, Artem!
In general, the task is clear, but for an accurate response regarding deadlines and pricing, I would like to clarify some questions that arose after analyzing your task.
Please write in private messages – we will discuss the details and your wishes.
Current freelance projects in the category Desktop Apps
Account reconciliation tool with the bank, cards, and accountantTechnical Assignment: Tool for Reconciling Accounts with Bank, Cards, and AccountantGeneral Goal A local tool (script/small application in Python) is needed, which is manually run once every 1-2 months on my computer and performs reconciliation between: Invoices I issued to… Python, Desktop Apps ∙ 1 day 21 hours back ∙ 39 proposals |
Add pauses of 10-30 seconds between sending emails.Hello! I am looking for an experienced 1C / BAS (BAF) programmer to promptly resolve a technical issue with email distribution.Problem essence: We use the accounting program BAF (Business Automation Framework), version 2.0. Once a month, there is a need to send about 300 emails… Web Programming, Desktop Apps ∙ 7 days 13 hours back ∙ 10 proposals |
Reverse engineering of console utilities for querying SSD controllers (Flash ID)1. Purpose of the work Extraction of the application programming interface (API) for interaction with SSD/NVMe controllers from the provided set of console utilities (Phison, Silicon Motion, Realtek, Maxiotek, Marvell, JMicron, etc.). The result should be working code in C/C++… C & C++, Desktop Apps ∙ 8 days back ∙ 6 proposals |