Category / Section
Does XlsIO support TSV files?
2 mins read
This article explains whether XlsIO supports TSV files.
Does XlsIO support TSV files?
XlsIO do support opening and saving of TSV files from the assembly version 14.1 onwards. XlsIO do not need string separator for opening TSV files.
Download input files with data
The following C#/VB complete code snippet explains the support of TSV files by XlsIO
C#
using Syncfusion.XlsIO; using System.IO; using System.Reflection; namespace XlsIO_Supports_TSV { class Program { static void Main(string[] args) { using (ExcelEngine excelEngine = new ExcelEngine()) { //Instantiate the excel application object. IApplication application = excelEngine.Excel; //The workbook is opened. IWorkbook workbook; //Open existing workbook with data entered Assembly assembly = typeof(Program).GetTypeInfo().Assembly; Stream fileStream = assembly.GetManifestResourceStream("XlsIO_Supports_TSV.Sample.xlsx"); workbook = application.Workbooks.Open(fileStream, ExcelOpenType.Automatic); //The first worksheet object in the worksheets collection is accessed. IWorksheet worksheet = workbook.Worksheets[0]; //Saving the workbook as TSV file Stream stream = File.Create("Output.tsv"); workbook.SaveAs(stream, "\t"); stream.Close(); //Re-Opening the saved TSV file workbook = application.Workbooks.Open("Output.tsv"); //Saving the workbook as xlsx file stream = File.Create("Output.xlsx"); workbook.SaveAs(stream); } } } }
VB
Imports Syncfusion.XlsIO Imports System.IO Imports System.Reflection Namespace XlsIO_Supports_TSV Class Program Private Shared Sub Main(ByVal args() As String) Using excelEngine As ExcelEngine = New ExcelEngine() 'Instantiate the excel application object. Dim application As IApplication = excelEngine.Excel 'The workbook is opened. Dim workbook As IWorkbook 'Open existing workbook with data entered Dim assembly As Assembly = GetType(Program).GetTypeInfo.Assembly Dim fileStream As Stream = assembly.GetManifestResourceStream("XlsIO_Supports_TSV.Sample.xlsx") workbook = application.Workbooks.Open(fileStream, ExcelOpenType.Automatic) 'The first worksheet object in the worksheets collection is accessed. Dim worksheet As IWorksheet = workbook.Worksheets(0) 'Saving the workbook as TSV file Dim stream As Stream = File.Create("Output.tsv") workbook.SaveAs(stream, "" & vbTab) stream.Close() 'Re-Opening the saved TSV file workbook = application.Workbooks.Open("Output.tsv") 'Saving the workbook as xlsx file stream = File.Create("Output.xlsx") workbook.SaveAs(stream) End Using End Sub End Class End Namespace