ByteScout Spreadsheet SDK - C# - Read Number Format In Cell - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Spreadsheet SDK – C# – Read Number Format In Cell

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Read Number Format In Cell

How to read number format in cell in C# using ByteScout Spreadsheet SDK

The tutorial shows how to read number format in cell in C#

ByteScout tutorials are designed to explain the code for both C# beginners and advanced programmers. ByteScout Spreadsheet SDK is the SDK component for writing, reading, modifying and calculating Excel and CSV spreadsheets. Can calculate and reculculate formulas with Excel installed. You may import or export data to and from CSV, XML, JSON. Supports export to databases, arrays, streams and you can use it to read number format in cell with C#.

C# code samples for C# developers help to speed up coding of your application when using ByteScout Spreadsheet SDK. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout Spreadsheet SDK in C# is also explained in the documentation included along with the product.

Free trial version of ByteScout Spreadsheet SDK is available on our website. Documentation and source code samples are included.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using Bytescout.Spreadsheet; using Bytescout.Spreadsheet.Constants; using System.IO; namespace HelloWorld { class Program { static void Main(string[] args) { // Create new Spreadsheet Spreadsheet document = new Spreadsheet(); document.LoadFromFile("Data.xls"); // Get worksheet by name Worksheet worksheet = document.Workbook.Worksheets.ByName("Sample"); // Check dates for (int i = 0; i < 8; i++) { for (int j = 0; j < 2; j++) { // Set current cell Cell currentCell = worksheet.Cell(i, j); // Get format type NumberFormatType formatType = currentCell.ValueDataTypeByNumberFormatString; // Write line Console.Write("Cell({0}:{1}) type is {2}. Value : ", i, j, formatType.ToString()); switch (formatType) { case NumberFormatType.DateTime: { // Read datetime DateTime date = currentCell.ValueAsDateTime; // Write date to console output Console.Write(date.ToString()); } break; case NumberFormatType.General: { // Write value to console output Console.Write(currentCell.Value); } break; } Console.WriteLine(); } } // Close document document.Close(); Console.ReadKey(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next