Import decimal numbers in Excel issue using Aspose.Cells Cloud API

When writing numeric data into cells using importdata in Cells for Cloud, I try set the type to numeric:

api-datatrue
10numeric4.34428240870546

This gives a 400 Bad Request as response.
The same happens when the type is set to int.
Setting the type to string gets the cell updated, but gives the “Number Stored as Text” warning making the cell unavailable for Excel functions.

Is there a way to format the request correctly to be able to write decimal figures that will be treated as numeric in the resulting Excel file?

Hi Ola,


Thank you for contacting Aspose support.

First of all, please note that 400 Bad Request error can only be observed when the URI (or the XML) is not in correct format therefore if you are getting the 400 error you need to verify if the URI and XML strings are correct. For instance, if the specified spreadsheet does not contain the specified worksheet (api-data in your case) then you will get 400 error or when you try to insert a decimal number with integer type.

Regarding your original concerns, I have verified the scenario against a sample of my own and following piece of code. I am afraid, I am not able to observe the said problem (numeric value being changed to text). Please note, the service only inserts the data without changing the underlying cell format.

Please review the attached samples as well as the following XML. In case you still find difficulties in implementing this scenario, please share the input spreadsheet and complete XML (if different than what you have already shared) for further investigation.

<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>
Sheet1
true


1
0
numeric
<value>4.34428240870546</value>


2
0
numeric
<value>4.34428240870546</value>


3
0
numeric
<value>4.34428240870546</value>


You are right, of course.


The problem lies in another field, the offending data being:
1
3
numeric
2.22044604925031E-14

This might happen if the content of the tag is on the exponential form.
The cause of this is in my case the ToString() function of the double type in C#.

Using double.ToString(“F”) will solve this problem.

Thank you for leading me on the right track.

Hi Ola,


Thank you for writing back, and it is good to know that you are able to figure out the problem cause. Please feel free to contact us back in case you need our further assistance with Aspose APIs.