Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Oct 13, 2017 10:08 am

Hi,

I am trying to convert a CSV file to excel using Spire.
I am calling Spire from my c# code.
It works fine for smaller files with 20-30 number of records.

If I run the same code against a csv file with 50000 records i get this error- errorspecified argument was out of the range of valid values.

I am using spire version 7.12.27.

Here is the code I am using to convert csv to excel-
Code: Select all
   Workbook workbook = new Workbook();
                workbook.LoadFromFile(@"E:\USer\test.csv", ",", 1, 1);
                Worksheet sheet = workbook.Worksheets[0];
                sheet.Name = "csv to excel";
                workbook.SaveToFile("E:\\USer\\test.xlsx", ExcelVersion.Version2010);   


Thanks,
Rooepsh

roopeshvp@gmail.com
 
Posts: 15
Joined: Thu May 04, 2017 6:50 am

Mon Oct 16, 2017 9:25 am

Hello Rooepsh,

Thanks for your inquiry.
Kindly note the default excel version of our product is Excel2003 when loading a csv file. Since the Excel 2003 or below has a limitation of 256 columns, the exception of "specified argument was out of the range of valid values" would occur if there are more than 256 columns in the 50000 records. To avoid it, you could declare the version to be 2007 or above while loading.
Code: Select all
workbook.LoadFromFile(@"E:\USer\test.csv", ",", 1, 1,ExcelVersion.Version2007);

If the issue still troubles you after trying the solution, please provide the sample .csv file.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue Oct 17, 2017 7:00 am

Hi Jane,
I tired this. I still get the same error.
I was debugging the C# code I have posted earlier in this question. Then i see that the exception is thrown even before actually loading the file.
I get the error in the following line. And the error is attached.

Is there something I am missing here?

I am finding great difficulty in navigating in this forum. Every time I click on post a reply it takes me to update your details page. And when I try to attach a file it says invalid token. Can you please fix this issue as well.

Thanks,
Roopesh
Attachments
Error.png
Error.png (30.83 KiB) Viewed 6631 times

roopeshvp@gmail.com
 
Posts: 15
Joined: Thu May 04, 2017 6:50 am

Tue Oct 17, 2017 8:17 am

Hi Roopesh,

Please make sure that you have referred all the dlls in the folder, which including the following 4: Spire.Pdf.dll, Spire.Common.dll, Spire.License.dll, and Spire.XLS.dll.
Moreover, the forum only supports the uploading of a compressed file and there's 10M size limitaion on the attachment, you could send the csv file to us via email(support@e-iceblue.com).
As for the page redirecting issue, sorry I didn't reproduced it with IE and google browser. Could you tell us which web browser you were using?

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Nov 15, 2017 5:40 pm

Hi Jane,

I was able to do this. For a large csv file with 700,000 records it took 50 minutes for spire to convert this to xlsx.
Is this the expected speed from spire for such a large file. Or is there anything i can do to make it faster?

Thank You.
Rooepsh

roopeshvp@gmail.com
 
Posts: 15
Joined: Thu May 04, 2017 6:50 am

Thu Nov 16, 2017 3:25 am

Hello Roopesh,

I tested a csv file with 700,00 records and it only cost me 6 minutes using the latest hotfix(Spire.XLS Pack(Hotfix) Version:7.12.109). We suggest you first try this version. If the issue still exists, please send your sample csv file to us(support@e-iceblue.com) and then we will look into it and see if any optimization can be implemented.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Nov 17, 2017 2:31 am

Hi Jane,
You missed a zero. I was trying for 700,000 and took 50 minutes.
You tried for 70,000 and got it in 5 minutes.

can you please try it with 700,000 records.

Thanks,
Roopesh

roopeshvp@gmail.com
 
Posts: 15
Joined: Thu May 04, 2017 6:50 am

Mon Nov 20, 2017 1:42 am

Hi Roopesh,

Thanks for your response.
Actually, I tried 700,000 rather than 70,000, and the whole process cost me 6minutes. It's my mistake for leaving out a zero.
I will send the file to you via email, please have a check.
On the other hand, we need your sample file so that we can locate the issue and provide a solution accordingly. Could you please share it via email?

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue Nov 21, 2017 6:48 am

Hi Jane,

Thank you for your efforts to help me in resolving this.

I tried conversion with the file you had sent. I was able to convert in 5 minutes.
However, my file has many more columns and the file size is around 250 MB in CSV format.
I have zipped and sent the file to you by email. Can you please try it and let me know how it performs.

Thanks,
Roopesh

roopeshvp@gmail.com
 
Posts: 15
Joined: Thu May 04, 2017 6:50 am

Tue Nov 21, 2017 9:02 am

Hello Roopesh,

I tested the file you provided and it cost me around 30 minutes. Anyway, I have delivered the issue to our dev team to investigate if any optimization could be done. Once there's any update, I will let you know.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Dec 01, 2017 8:41 am

Hi Jane,

Do you have any update for me on this issue?

Thanks,
Roopesh

roopeshvp@gmail.com
 
Posts: 15
Joined: Thu May 04, 2017 6:50 am

Fri Dec 01, 2017 10:04 am

Hello Roopesh,

Thanks for contacting us.
I just got a news from our dev team that your issue is still under investigation due to the complexity. Concerning this, your issue might not be resolved in a short time. Our dev team will continue looking for the solutions. Once there's any progress, I will let you know.
Sorry for the inconvenience caused.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.XLS