DEV Community

loading...

Convert TSV to Excel in C#.NET

asposecells profile image AsposeCells Updated on ・4 min read

TSV file is an abbreviation of Tab-separated values. It is a type of delimited text file. A delimiter is a sequence of one or more characters to specify the boundary between separate, independent regions in plain text or other data streams. Since the delimiter in TSV file is Tab that separates fields in a row, therefore it is called Tab-separated values. Aspose.Cells for .NET is capable of loading the TSV file and converting it to various Excel formats e.g. XLS, XLSX, XLSM, XLSB etc. It can also convert TSV file into non-Excel formats e.g. HTML, PDF etc. You can also convert your TSV file into Image formats e.g. JPG, PNG, TIFF etc.

Convert TSV to Excel Formats

In this document, we will explain how to convert your TSV file into various Excel formats e.g. XLS, XLSX, XLSM, XLSB etc. Please download the sample TSV file used inside the code as shown in this image for your reference.

Sample TSV file to be converted to Excel formats using Aspose.Cells API

Sample TSV file to be converted to Excel formats using Aspose.Cells API

Convert TSV to XLS format

XLS is a very important Excel format. It is available since the Excel 2003 or may be earlier and still lots of Excel documents are saved in this format. XLS format is a sort of binary format and it can also contain Macros or VBA. Aspose.Cells which is an API provided by Aspose can convert your TSV file to XLS format using the following code.

The following screenshot shows the output XLS file generated by the above code for your reference.

Convert TSV to XLS format using Aspose.Cells API

Convert TSV to XLS format using Aspose.Cells API

Convert TSV to XLSX format

XLSX is a newer Microsoft Excel Open XML Format. It is kind of XML based format and stores the spreadsheet data in XML structures. It is widely used format since Excel 2007 and till today. Normally, you should save your Excel files in XLSX format rather than XLS format. Besides, XLS can have at most 65536 rows while XLSX can have 1048576 rows which is far greater than XLS. Similarly, XLS can have 256 columns and XLSX can have 16384 columns which is again far greater than XLS.

However, unlike XLS format, XLSX format cannot contain Macros or VBA. If you want to use XLSX format benefits and also want to use Macros or VBA, then you should use XLSM format which is actually a Macro-Enabled XLSX format. The following sample code explains how you can convert your TSV file to XLSX format using Aspose.Cells API.

The following screenshot shows the output XLSX file generated by the above code for your reference.

Convert TSV to XLSX format using Aspose.Cells API

Convert TSV to XLSX format using Aspose.Cells API

Convert TSV to XLSM format

XLSM format is same as XLSX but it supports VBA or Macros. It is therefore called Macro-Enabled XLSX format. The following sample code explains how you can convert your TSV file to XLSM format using Aspose.Cells API.

The following screenshot shows the output XLSM file generated by the above code for your reference.

Convert TSV to XLSM format using Aspose.Cells API

Convert TSV to XLSM format using Aspose.Cells API

Convert TSV to XLSB format

XLSB format is same as XLSM format but unlike XML-based format, it is a binary format. Binary formats are often used to save the file size which is useful in scenarios where user needs to transfer files on network.

The following screenshot shows the output XLSB file generated by the above code for your reference.

Convert TSV to XLSB format using Aspose.Cells API

Convert TSV to XLSB format using Aspose.Cells API

See also

Discussion (0)

pic
Editor guide