Import String Array into Excel Worksheet – Aspose.Cells Cloud
Importing a string array into an Excel worksheet is a common task when populating spreadsheets with list‑based data. This operation is useful for scenarios such as loading configuration values, transferring data from external sources, or initializing worksheets with predefined string collections.
Prerequisites:
- A valid JWT token obtained via the Aspose.Cells Cloud authentication flow.
- An existing workbook (or the ability to create one) in your Aspose Cloud storage.
- The appropriate SDK version that supports the
ImportStringArrayOptionmodel.
This REST API imports string‑array data into an Excel worksheet.
PostImportData API
POST https://api.aspose.cloud/v3.0/cells/import
Security and Authentication
The Aspose.Cells Cloud APIs are secure and require JWT token-based authentication.
Request Parameters
The request uses multipart HTTP content (see RFC 2046 or RFC 1341).
The first part of the multipart body contains an ImportStringArrayOption payload; the second part contains the source data file.
The important parameters are described in the following table:
| Parameter Name | Type | Description |
|---|---|---|
| FirstRow | int | The starting row index (1‑based) where the data will be placed. |
| FirstColumn | int | The starting column index (1‑based) where the data will be placed. |
| IsVertical | boolean | true to insert data vertically; false to insert horizontally. |
| Data | String[] | The string array to be imported. |
| DestinationWorksheet | string | The name of the worksheet that will receive the data. |
| IsInsert | boolean | true to insert rows/columns (shifting existing cells); false to overwrite existing cells. |
| ImportDataType | string | Type of data being imported (e.g., IntArray, DoubleArray, StringArray, TwoDimensionIntArray, TwoDimensionDoubleArray, TwoDimensionStringArray, BatchData, csvData). |
| Source | FileSource | Describes where the data file resides when BatchData is null (e.g., CloudFileSystem, LocalFile). Required if BatchData is not supplied. |
Example
<ImportStringArrayOption>
<DestinationWorksheet>Sheet1</DestinationWorksheet>
<IsInsert>false</IsInsert>
<ImportDataType>StringArray</ImportDataType>
<FirstRow>1</FirstRow>
<FirstColumn>1</FirstColumn>
<IsVertical>true</IsVertical>
<Source>
<FileSourceType>CloudFileSystem</FileSourceType>
<FilePath>Array_string_xml.txt</FilePath>
</Source>
</ImportStringArrayOption>
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 speed up development. An SDK handles low‑level details, allowing you to 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: