CSV file - treat consecutive delimiters as distinct

Hello.

It seems that for CSV files Aspose-Cells treats consecutive delimiters as one. In MS Excel this is an option. What is the TxtLoadOption that allows to treat consecutive delimiters as distinct?

For sake of completeness, I’d add that empty values are honored, if marked with a couple of double quotes.

I also upload some CVS files and Excel screenshots.
AsposeCsvConsecutiveDelimiters.zip (173.6 KB)

Thank you.

@renato.mauro,

Thanks for the sample files.

How do you import/load your CSV file? I tried your scenario/ case a bit using the following sample code and it works fine. I am using latest version/fix: Aspose.Cells for Java v18.9.x (please try it if you are not already using it). I imported your CSV file into the Workbook and finally saved to CSV file format. The output CSV is fine tuned and as expected. It does not treat consecutive delimiters as one (which you want):
e.g
Sample code:

TxtLoadOptions loadOptions = new TxtLoadOptions(LoadFormat.CSV);

		Workbook template = new Workbook();
		WorksheetCollection templateWorkSheets = template.getWorksheets();
		Worksheet exportWorksheet = templateWorkSheets.get(0); 
		exportWorksheet.getCells().importCSV("f:\\files\\EmptyColumns.csv",loadOptions,0,0);
	
		template.save("f:\\files\\out1.csv", SaveFormat.CSV);

If you are using some other scenario/ case, kindly do provide us more details and sample code to reproduce the issue on our end, we will check it soon.

Hi Amjad.

Thanks for your answer. Here linked the whole bunch of files to build and reproduce.
2 ASPOSETEST.zip (56.1 KB)

I beg your pardon, I gave you an incomplete information: the problem is reproducible if the separator is different than comma. So, in the zip you may find both working and not working cases, the latter ones with ‘SpaceDelimiter’ in their name.

Thank you for your help.

@renato.mauro,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42734 - Issue while treating consecutive delimiters as distinct
1 Like

@renato.mauro,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42734”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

We have provided new option for this requirement:

TxtLoadOptions.TreatConsecutiveDelimitersAsOne

It works in the same way as MS Excel, you may set it explicitly according to your requirements. By default it is true for separator ’ ’ and false for other separators.

1 Like

Great news, thank you so much!

@renato.mauro,

You are welcome.

@renato.mauro,

Please try our latest version/fix: Aspose.Cells for Java v18.10.1 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells for Java_v18.10.1.zip (6.3 MB)

Yes, it works.
Thank you so much for your quick and effective reaction.

@renato.mauro,

Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSJAVA-42734) have been fixed in Aspose.Cells for Java 18.11. You can also get the latest Aspose.Cells for Java version from Maven repos. with simple configurations. Please see the document for your reference: Installation|Documentation

This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi