Loading .CSV from File Fails on Column with Number then Text

When I create a new workbook from a .CSV file if the file has a column that contains a number in the first row and then contain text in subsequent rows fails to load. The error message is: <!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>The value of the cell
C2 should not be a string value.<!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–> The code I used was:
Aspose.Cells.Workbook awb = new Aspose.Cells.Workbook(strFilePath, new Aspose.Cells.LoadOptions(LoadFormat.CSV));

The first row, column C contained a number like 999999. The second row contained text like 9999-9999-9999. These are part numbers that will contain all sorts of character combinations and should be treated as text.

I fixed this particular file by moving the text row in front of the row with a number. But this is supposed to be an automatic load for the user.

Any ideas how to fix this?

Hi William,

Thanks for your posting and using Aspose.Cells.

You should try opening your CSV file in MS-Excel. If MS-Excel can open it well, then Aspose.Cells should also be able to open it fine.

Please also download and try the latest version: Aspose.Cells for .NET (Latest Version) and see if it resolves your issue.

If your problem persists, then please provide us your source csv file, so that we could test your issue at our end and log it in our database for a fix.

I’m not sure that a Java update will help me with .Net, but I’ve included the file.

Hi,

Thanks for using Aspose.Cells.

Please download and use the latest .NET version: Aspose.Cells for .NET (Latest Version) it is working fine and loading your CSV successfully.

I have tested your file with the following code. I have also attached the output xls file for your reference.

C#


Workbook workbook = new Workbook(“2500038268_01_20140211_Pricing+Output.CSV”);

workbook.Save(“out.xls”,SaveFormat.Excel97To2003);

I also got same problem with aspose " The value of the cell K4 should not be a string value"
could not able to resolve.i am using version 8.3.1.0.

i am dealing with excel file with a columns may contain string as well as integer data.
for this requirement aspose dll will work or not?

@kirankaredla,

We recommend you to kindly try our latest version/fix (e.g Aspose.Cells v17.12.x) as we have made many enhancements and other fixes in recent versions. If you still find any issue with latest version/fix, kindly provide us your source file (you may zip the file to attach it here) and paste your sample code (runnable) to reproduce the issue, we will check it soon.