Extract images (Ximage)

circle-exclamation
circle-exclamation

Spark can return mapped images as part of the API response. This can be useful for using Spark services to feed image elements to a front-end.

Map the images

Syntax: Ximage_<parameter>

  1. Click on the target chart or image.

  2. As described in Define a named range in Excel, use the Name Box to create a Name for the image. See a demonstration of this step herearrow-up-right.

  3. When creating the Name, use the noted prefix defined in the syntax.

  4. The remaining steps are similar to Map the report.

  5. After the service is uploaded to Spark, this can be tested in the API Tester.

  6. In the API Tester, in the Field view, there will be a list of all the Ximages defined in the workbook.

  7. There is a field that can be used to define the FileName parameter of the API request. This is used to customize the resulting filename.

  8. Submit the API request.

  9. In the API response JSON view, the report object will include a link to the resulting image file.

circle-info

Ximage does not support Excel 3D charts.

Return an image as a Base64 string

Syntax: Ximage_metadata.<parameter>

Images can be returned as a Base64 string. This can be easier to use than an attachment when integrating the API response to a front-end. This works when the image is defined as part of the Metadata subservice.

The mapping procedure is the same as Map the images.

Return Original file size images

Syntax: Ximageoriginal_<parameter> or Ximageoriginal_metadata.<parameter>

Ximage will return an image that has been resized based upon its dimensions in an Excel file. To return an image in its original quality and file size, use the alternative Ximageoriginal mapping.

The mapping procedure is the same as Map the images.

  • This functionality supports JPEG or PNG images but not Excel charts

  • You must also enable Do not compress images in file in Excel Options > Advanced.

Example of Ximage mapping

This service can be uploaded to Spark to use as a simple example.

file-download
93KB
Example File

Last updated