ByteScout Spreadsheet SDK – C# – Export To DataTable

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Export To DataTable

ByteScout Spreadsheet SDK – C# – Export To DataTable

Program.cs

using System;
using System.Data;

namespace Bytescout.Spreadsheet.Demo.Csharp.ExportToDataTable
{
class Program
{
static void Main(string[] args)
{
const string inputFile = @”PeriodicTableOfElementsSpreadsheet.xls”;

// Open and load spreadsheet
Spreadsheet spreadsheet = new Spreadsheet();
spreadsheet.LoadFromFile(inputFile);

// Get the data from the spreadsheet
DataTable dt = spreadsheet.ExportToDataTable();

// Close spreadsheet
spreadsheet.Close();

// Display array
for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { Console.Write(dt.Rows[i][j] + " "); } Console.WriteLine(); } // Pause Console.ReadLine(); } } } [/csharp]


  Click here to get your Free Trial version of the SDK

prev
next