Import Picture into Excel Worksheet – Aspose.Cells Cloud API Guide

Importing a picture into an Excel worksheet allows you to enrich spreadsheets with visual content such as logos, charts, or diagrams. This guide shows how to use the Aspose.Cells Cloud ImportPicture operation, the required request format, and how to handle responses.

REST API

POST https://api.aspose.cloud/v3.0/cells/import
POST https://api.aspose.cloud/v3.0/cells/{name}/importdata

Security and Authentication

The Aspose.Cells Cloud APIs are secure and require JWT token-based authentication.

Request Parameters

The request is an HTTP POST with multipart/related content (see RFC 2046 or RFC 1341).

  • The first part contains a JSON object named ImportPictureOption that describes where and how the picture should be placed.
  • The second part carries the image file (or its Base64‑encoded data).

ImportPictureOption – definition

{
  "UpperLeftRow": 0,
  "UpperLeftColumn": 0,
  "LowerRightRow": 10,
  "LowerRightColumn": 5,
  "Filename": "logo.png",
  "Data": "iVBORw0KGgoAAAANSUhEUgAA...",
  "DestinationWorksheet": "Sheet1",
  "IsInsert": true,
  "ImportDataType": "Picture",
  "Source": { "FileSource": "Storage" }
}

IsInsert is a booleantrue inserts a new picture, false replaces an existing one.

Important parameters

ImportPictureOption

Parameter Name Type Description
UpperLeftRow int Row index of the upper‑left corner where the picture will be placed.
UpperLeftColumn int Column index of the upper‑left corner where the picture will be placed.
LowerRightRow int Row index of the lower‑right corner that defines the picture’s bounds.
LowerRightColumn int Column index of the lower‑right corner that defines the picture’s bounds.
Filename string Name of the picture file.
Data string Base64‑encoded binary data of the picture (optional if the file is sent as the second part).
DestinationWorksheet string Name of the worksheet where the picture will be inserted.
IsInsert boolean true to insert a new picture; false to replace an existing one.
ImportDataType string Type of data being imported (e.g., Picture, IntArray, DoubleArray, StringArray, TwoDimensionIntArray, TwoDimensionDoubleArray, TwoDimensionStringArray, BatchData, csvData).
Source FileSource Indicates the data file’s location when the BatchData parameter is null.

Response

A successful request returns HTTP 200 with a JSON payload similar to:

{
  "Code": 200,
  "Status": "OK"
}

Possible status codes:

Code Meaning
200 Import succeeded
400 Bad request – missing or invalid data
401 Unauthorized – invalid or missing token
500 Internal server error

How to Use the PostImportData API with SDKs

PostImportData API Specification

The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.

Use Aspose.Cells Cloud SDKs

Using an SDK is the best way to accelerate development. An SDK handles low‑level details so you can focus on your project tasks. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.

The following code examples demonstrate how to call Aspose.Cells web services using various SDKs: