How to Replace Product Names with EAN Codes in Excel Photo URLs
Question details
The user needs to dynamically replace product names embedded within photo URL strings with their corresponding EAN codes in an Excel spreadsheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Managing product image links where the downloaded filename needs to match the EAN code instead of the product name for bulk downloading and accurate file naming.
- Observed behavior
- The current photo URLs contain product names, and the user needs to update the URL text strings to contain the EAN codes instead, requiring a bulk text replacement method.
Ensure your EAN codes and product names are organized in separate columns without any leading or trailing spaces. It is highly recommended to duplicate your original URL column before applying formulas to prevent accidental data loss.
Use the SUBSTITUTE Function to Replace Text Dynamically
The most efficient way to replace a specific substring (product name) with another (EAN code) inside a URL string is by using Excel's built-in SUBSTITUTE function.
This method is ideal if your worksheet is structured with EAN codes, product names, and URLs in consistent columns. It allows for dynamic updates, meaning if an EAN code changes, the URL will automatically update.
Verify the locations of your data. For example, assume Column A contains EAN Codes, Column B contains Product Names, and Column C contains the Photo URLs.
Click on an empty cell in a new column (e.g., cell D2) and type the formula: =SUBSTITUTE(C2, B2, A2). This tells Excel to look at the URL in C2, find the product name from B2, and replace it with the EAN code from A2.
Press Enter to generate the new URL. Click on cell D2, grab the small square at the bottom-right corner of the cell (the fill handle), and drag it down to apply the formula to the rest of your list.

Use Find and Replace for Manual Updates
If you only have a few specific product names to replace across your sheet, the standard Find and Replace tool offers a quick fix without the need for formulas.
Easily Manage Formulas and URLs with WPS Office
WPS Spreadsheet provides seamless compatibility with Excel formulas like SUBSTITUTE, making bulk text replacement in URLs fast and straightforward. It's a free, lightweight solution for all your data management needs.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your product URLs and EAN codes.
- 2. Insert the replacement formula: Type =SUBSTITUTE( in an empty cell next to your original URL.
- 3. Select your cell references: Click the URL cell, type a comma, click the product name cell, type a comma, and finally click the EAN code cell. Press Enter.
- 4. Autofill your entire list: Double-click the fill handle in the bottom-right corner of the formula cell to instantly replace product names across thousands of rows.

Frequently Asked Questions
Why isn't the SUBSTITUTE function replacing the product names in my URLs?
The SUBSTITUTE function is case-sensitive. If the product name in your reference cell is 'Apple' but the URL contains 'apple', it will not be replaced. Ensure the casing matches, or use upper/lower functions to standardize the text before replacing.
Can I remove special characters from product names before replacing them in URLs?
Yes. You can nest multiple SUBSTITUTE functions to clean up product names by stripping out hyphens or spaces (e.g., replacing spaces with hyphens if the URL uses hyphens) before running the final replacement against the URL.
How do I handle file extensions when replacing names with EAN codes?
If the product name being replaced doesn't include the file extension (like .jpg or .png), the extension will remain untouched at the end of the URL. If the file extension is accidentally overwritten, simply append &'.jpg' to the end of your formula.
How do I download these images using the newly generated EAN filenames?
Excel itself does not natively download images directly from URLs in bulk. Once your URLs are updated with the EAN codes, you will need to use a VBA macro or a third-party bulk image downloader tool, feeding it your newly generated list of URLs.




