Can the Excel Image function accept a "data" url as the source?

Johnny Spicer 0 Reputation points
2024-05-27T09:20:56.3166667+00:00

Hello,

I'm currently developing a Javascript add-in for Excel.

During the development process, I have used both the addImage function to include images and the WebImage data type.

The current interaction of the code is using the WebImage data type. The code base has been extended so it can create images internally, unfortunately, the WebImage data type does not appear to support a base64 data URL as a source. Whilst I could use the addImage function to add the images to the document they won't be "in a cell" they are over in the shapes layer.

Is there any way of adding an image to the document and then "placing it in a cell".

Why not use "addImage"? Filtering in Excel whilst powerful doesn't always correctly filter the images associated with the shape layer, so often the images displayed are wrong for the row or some are left behind, place in cell avoids this problem.

So to reiterate my question is there a way to add and image from base64 data URL but still place the image in a cell (ie a WebImage)?

Kind regards

Johnny

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,954 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
996 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,974 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mansoob e Zahra 235 Reputation points
    2024-07-06T08:29:33.23+00:00

    Currently, Excel JavaScript API does not support directly inserting images from a base64 data URL into a cell as a WebImage. The WebImage data type is designed to support URLs of web-hosted images, and it does not handle base64 data URLs.

    However, there is a workaround that involves using the addImage function to insert the image and then adjusting its position and size to make it appear as if it is inside a cell.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.