Import CSV Data into Excel Worksheet
This REST API imports CSV data into an Excel worksheet.
The request is an HTTP request with multipart content (see RFC 2046 or RFC 1341). The first part of the multipart content contains the ImportCSVDataOption data and the second part contains the CSV file.
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.
The important parameters are described in the tables below.
ImportCSVDataOption
| Parameter Name | Type | Description |
|---|---|---|
| SeparatorString | string | Character used to separate fields in the CSV file (e.g., , or ;). |
| ConvertNumericData | string (true/false) |
Indicates whether numeric strings should be converted to numeric values. |
| FirstRow | int | 1‑based index of the first row where the data will be placed. |
| FirstColumn | int | 1‑based index of the first column where the data will be placed. |
| SourceFile | string | Name of the source CSV file to be imported. |
| CustomParsers | List<CustomParserConfig> | Collection of custom parser configurations for specific columns. |
CustomParserConfig
| Parameter Name | Type | Description |
|---|---|---|
| ColumnIndex | int | Zero‑based index of the column to which the custom parser applies. |
| ParseMethod | string | Parsing method for the column (e.g., ToString, ToDate, ToNumber). |
| CustomStyle | string | Custom style (e.g., number format) applied to the parsed cells. |
Example
<ImportCSVDataOption>
<DestinationWorksheet>Sheet1</DestinationWorksheet>
<IsInsert>true</IsInsert>
<ImportDataType>CSVData</ImportDataType>
<SeparatorString>;</SeparatorString>
<ConvertNumericData>true</ConvertNumericData>
<FirstRow>1</FirstRow>
<FirstColumn>2</FirstColumn>
<SourceFile>TestImportDataCSV.CSV</SourceFile>
<CustomParsers>
<CustomParserConfig>
<ColumnIndex>0</ColumnIndex>
<ParseMethod>ToString</ParseMethod>
<CustomStyle>#</CustomStyle>
</CustomParserConfig>
</CustomParsers>
</ImportCSVDataOption>
Response
{
"Status":"OK",
"Code":200
}
Http Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Compression succeeded; response contains compressed file details. |
| 400 | Bad Request | Missing or invalid parameters (e.g., unsupported file type). |
| 401 | Unauthorized | Invalid or missing JWT token. |
| 413 | Payload Too Large | Uploaded file exceeds size limit. |
| 500 | Internal Server Error | Unexpected server error. |
How to Use the PostImportData API with SDKs
PostImportData API Specification
The OpenAPI Specification defines a publicly accessible programming interface that allows you to perform REST interactions directly from a web browser.
Use Aspose.Cells Cloud SDKs
Using an SDK is the best way to accelerate development. An SDK abstracts low‑level details, allowing you to focus on your business logic. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.
The following code example demonstrates how to call the Aspose.Cells web service using the PHP SDK: