KutoolsforOffice — One Suite. Five Tools. Get More Done.

How to insert pictures into cells by matching file names in Excel

AuthorsunLast modified
Quick Answer

Excel has no built-in way to insert local picture files by matching them to cell text, and the IMAGE function only accepts web addresses. With Kutools for Excel, select the names, click Kutools Plus > Import & Export > Match Import Pictures, add the pictures, and click Import.

You have a product list in column A and a folder of photos named after the products, such as Desk Lamp.jpg and Coffee Mug.jpg. You want each photo in the cell next to its name. Excel can insert pictures, but it does not know which picture belongs to which name. The IMAGE function reads pictures from a web address, not from a folder on your computer.

Can Excel do this on its own?

Not by matching names. Insert > Pictures > This Device lets you select many files at once, but they land as loose pictures. You then move and resize each one by hand, and the work only grows with the list. The IMAGE function needs a picture hosted online and cannot read a file path on your computer.

Matching pictures to names automatically is only possible with a VBA macro. That brings the usual costs:

  • The workbook has to be saved as .xlsm, and everyone who opens it must enable macros.
  • The folder path and the cell range are typed into the code, so the macro has to be edited for every new list or folder.
  • It does not run in Excel for the web.

How to insert pictures by matching file names with Kutools for Excel

Kutools for Excel, an Excel add-in by ExtendOffice, has a Match Import Pictures feature. It reads the names in a column or row, finds the picture files with the same names, and places each picture in a cell. No code is needed.

Before you start: Download and install Kutools for Excel (free trial available). Name each picture file exactly like its cell text, for example Desk Lamp.jpg for a cell that contains Desk Lamp, and keep the files together in one folder.

  1. Select the cells that contain the names (here A2:A7), and click Kutools Plus > Import & Export > Match Import Pictures.
Excel with product names A2:A7 selected and the Kutools for Excel Import & Export menu open with Match Import Pictures highlighted
Select the product names, then click Kutools Plus > Import & Export > Match Import Pictures
  1. The selected cells appear in the Match range box. Click Add and choose File to pick individual picture files, or Folder to add a whole folder.
Kutools for Excel Match Import Pictures dialog with the Add menu showing File and Folder
The Add button offers File and Folder
  1. Under More options, choose how big the pictures should be and in which order they are filled. Each name now has its matching picture in the list.
Kutools for Excel Match Import Pictures dialog with six names matched to their picture files and Matching cell size selected
1 Match range, 2 Add, 3 More options, 4 Import
  1. Click Import, enter the first cell for the pictures (here B2), and click OK.
Kutools for Excel Match Import Pictures prompt asking for the top-left cell, with $B$2 entered
Enter the top-left cell for the pictures
Excel product list with six pictures imported into B2:B7 by Kutools for Excel Match Import Pictures
Each picture sits next to its product name

The numbers in the dialog screenshot match this table:

#OptionWhat it does
1Match rangeThe cells with the names to match. Use a single column or a single row. It is filled in from your selection.
2AddAdds pictures from files or from a folder. Only pictures whose file name matches a cell are listed.
3More optionsImport size: the picture size. Import order: the fill direction.
4ImportAsks for the first cell, then inserts the pictures. It stays unavailable until pictures are added.

The toolbar above the list also has Remove and Remove all for the list, and a Case sensitive check box for matching letter case exactly.

Choose the picture size

The Import size list has three choices:

ChoiceResult
Matching itself sizePictures keep their own size. This is the default.
Matching cell sizePictures are sized to fit the cell. The Import size column shows a dash until you import.
Specify sizeYou enter a height, a width, or both, in points.
Kutools for Excel Match Import Pictures dialog with Specify size selected and 60 entered in the Height box
Specify size with a height of 60 points

Note. With Specify size, you can enter only the height or only the width. The other value adjusts to the aspect ratio of the picture.

Fill across a row

By default the pictures fill down the column (Fill vertically cell after cell). Under More options, choose Fill horizontally cell after cell to place them left to right instead.

Excel (VBA) vs. Kutools for Excel

Excel with VBAKutools for Excel
SetupWrite or paste a macro, then edit the folder path and rangeSelect the names and use one dialog
File format.xlsm, macros must be enabledNormal .xlsx
Picture sourceWhatever the code points toIndividual files or a whole folder
MatchingWritten in the codeBy file name; unmatched files are left out of the list
Picture sizeSet in the codeOwn size, cell size, or a height and width you enter
UndoNot available after a macro runsCtrl + Z removes the import in one step
Someone without Kutools opens the fileMacros are blocked unless enabledPictures are ordinary pictures and display normally

FAQ

Is there a way to insert pictures into cells by name in Excel without VBA?

Yes. In Kutools for Excel, select the name cells and click Kutools Plus > Import & Export > Match Import Pictures. Add the pictures and click Import. You do not need macros.

Can the IMAGE function insert pictures from a folder on my computer?

No. IMAGE takes a web address, so the picture has to be hosted online first. To insert local files by matching them to names, use Match Import Pictures in Kutools for Excel.

How are pictures matched to cells, and what about files that match nothing?

A picture matches a cell when its file name, without the extension, is the same as the cell text. In the example, Desk Lamp.jpg matched the cell Desk Lamp. A file with no matching cell, such as an extra Stapler.jpg in the same folder, was not added to the list. Tick Case sensitive if letter case must match exactly.

Are the imported pictures inside the cells?

No. They are ordinary pictures placed over the cells. Click one and Excel shows its Picture Format tab. With Matching cell size, each one is sized to its cell.

What happens if someone without Kutools opens my file?

The pictures are stored in the workbook as ordinary pictures, so they display for anyone. Without Kutools for Excel installed, that person cannot use the Match Import Pictures dialog to add or replace pictures by name.

Can I undo the import?

Yes. Press Ctrl + Z right after importing and all the pictures from that import are removed in one step.

Summary

Excel cannot match picture files to cell text on its own. The IMAGE function needs a web address, and the only automatic way for local files is a VBA macro that you must keep editing. With Kutools for Excel, select the names, click Kutools Plus > Import & Export > Match Import Pictures, add the pictures, choose a size and an order, and click Import.

Download Kutools for Excel

Free to reuse

All content in this article (including images and videos) may be used freely for commercial or non-commercial purposes without our permission.

Best Office Productivity Tools

🤖Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |  Round without Formula ...
Super Lookup: Multiple Criteria VLookup  |   Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |  Big Formula Bar   |  Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells   |  Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in