0

Is it possible to convert a .csv file to .xlsb programatically ? (Preferrably C#)

Convert XLS to XLSB Programatically?

shows how to convert XLS to XLSB , can I use the same to convert it from.csv? Won't there be any formatting issues? I am doing this on the server side because the .xlsb file size is very small compared to a .csv file, and I don't have an option of zipping my file.

Community
  • 1
  • 1
Ujjwal Vaish
  • 373
  • 1
  • 7
  • 21

2 Answers2

3

Take a look at EPPlus. I have used this extensively with great success. Fantastic Excel library and it's open source.

And, yes, there certainly will be formatting issues. You cannot go from XLS to CSV and maintain any of the original formatting because .CSV is pure text.

Randy Minder
  • 47,200
  • 49
  • 204
  • 358
  • I don't think excelpackage has the capability to do this, I am already using it in my application. – Ujjwal Vaish Jul 31 '14 at 12:54
  • It can be done. Here is an example: http://codejournal.blogspot.com/2012/03/using-epplus-library-to-convert-xlsx-to.html – Randy Minder Jul 31 '14 at 13:06
  • 1
    That shows the conversion from xlsx to csv , I need it for csv to xlsb. The thing is , while converting a file to xlsb , we get some errors. For the rest of the conversions , it's fine. Thanks for your interest though , appreciate it. :) – Ujjwal Vaish Aug 01 '14 at 06:41
0

Aspose.Cells File Format API can convert your CSV file to XLSB format. Please see the following sample code and screenshots for your reference.

C#

// Directory path for input and output files.
string dirPath = "D:\\Download\\";

// Load your sample CSV file inside the Workbook object.
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(dirPath + "sampleConvertCSVToExcelFormats.csv");

// Save CSV file to XLSB format.
wb.Save(dirPath + "outputConvertCSVToExcelFormats.xlsb", SaveFormat.Xlsb);

Screenshots of Sample CSV and Output XLSB files

Sample CSV File: Sample CSV file to be converted to Excel formats using Aspose.Cells API

Output XLSB file Convert CSV to XLSB format using Aspose.Cells API

Thank you and regards.

shakeel
  • 1,717
  • 10
  • 14