Screenshot 2025-03-14 at 7.09.09 PM

Bulk Importing Google Images to Odoo Products or Product Variants

Home » Company Bee Blog » Bulk Importing Google Images to Odoo Products or Product Variants

In my experience, Odoo will not import images based on a directory path. This means you need a remote URL for each image in order to do the bulk import.

I know there are more intricate and "proper" ways to do this programatically, with APIs, with scripts, etc. - but this is a quick & dirty.

 

Step 1: Create a folder on Google Drive & change permissions on that drive so anyone with the link can open it.

Screenshot 2025-03-14 at 5.54.00 PM

Step 2: Name your images to match the internal reference of the product. So, if the product internal reference is "widget-blue", name the image "widget-blue.png". Upload those images to your new Google Drive folder

Step 3: Create a Google Spreadsheet, then go back to your Google Drive folder and Ctrl+A (or Cmd+A) to select all of the image files. Once they're selected, click Ctrl+C (or Cmd+C) to copy. You can also use the Edit > Copy function of the browser, but to NOT right-click the files and make a copy, this won't work.

 

Step 4: Go to your spreadsheet and place your cursor where you want to paste the file data. Then, right-click in the cell and select Paste Special > Values Only

Screenshot 2025-03-14 at 6.01.09 PM

This should paste the filenames of each file.

Screenshot 2025-03-14 at 6.03.48 PM

Immediately after that, go to cell B1 and right-click > Paste. This gives adds the file names. They will paste as links, but that's fine.

Screenshot 2025-03-14 at 6.16.25 PM

Let's quickly get the filename without the extension. This should then match the product's internal reference, and we'll use it to bring the data together later.

Use this code in cell C1 and fill it down. If you used .jpg files, then substitute ".png" with ".jpg":

=SUBSTITUTE(B1,".png","")

Screenshot 2025-03-14 at 6.19.05 PM

Step 5: Now we need to convert the file link in column A to a URL that will play well with Odoo. The first step is to extract the image ID into its own cell. Do this using the following code in column D.

=regexextract(A1,"=([0-9a-zA-Z\-]+)")

Screenshot 2025-03-14 at 6.21.19 PM

In column E, you can build the URL using the following code:

="https://drive.google.com/uc?id="&D1

Screenshot 2025-03-14 at 7.13.13 PM

Step 6: We'll now have all of the data we need to match the image name and filename to the product or product variant. For this example, I'll use product variant records. I've gone to the product template, then clicked the Variant smart button.

Screenshot 2025-03-14 at 2.39.28 PM

Next, I'll select all variants and export them (Action > Export) with the Internal Reference field, being sure to select the "I want to update data (import-compatible export)" option. When I'm working in Google Sheets, I always export as CSV because its easier to import those records. However, you can do it as XLSX as well.

Screenshot 2025-03-14 at 6.26.37 PM

Import this date into a different tab on the same spreadsheet. This will give you the External ID (id) and Internal Reference. In column C, add the header:

  • Images / Image if you're importing to the product.template (base product), which is done from the Products > Product view
  • Variant Image if you're importing into the product.product (product variant), which is done from the Products > Product Variants view

Then, use an index/match or hlookup function in sheets to pull in the image URL based on a match between the internal reference and the image file name.

An example of the VLOOKUP formula would be as follows, where 'Sheet 2' is the sheet containing your image data:

=VLOOKUP(B2,Sheet2!$C$1:$E$4,3,false)

An example of the index/match formula would be as follows, where 'Sheet 2' is the sheet containing your image data:

=index(Sheet2!E:E,match(B2,Sheet2!C:C,false))

Next, remove the column header "internal reference" in B1, you won't need this moving foward.

This sheet is ready to export and import into Odoo! Remember that using Images / Image applies to product templates (product.template) and Variant Image / Image applies to product variants (product.product).

Screenshot 2025-03-14 at 7.01.55 PM

Step 6: Go to Odoo and import the records. Again, this example is for product variants.

Screenshot 2025-03-14 at 7.07.42 PM

Once imported, we can see that the main image for the product variant has been updated.

Screenshot 2025-03-14 at 7.09.09 PM