Skip to content

Instantly share code, notes, and snippets.

@groupdocs-com-kb
Last active August 23, 2024 18:06
Extract Text from XLSX using C#. For more information, please follow link: https://kb.groupdocs.com/parser/net/extract-text-from-xlsx-using-csharp/
using System;
using System.IO;
using GroupDocs.Parser;
using GroupDocs.Parser.Options;
namespace ExtractTextfromXLSXusingCSharp
{
internal class Program
{
static void Main(string[] args)
{
// Apply the license to remove the limitations of the Parser library
License lic = new License();
lic.SetLicense(@"GroupDocs.Parser.lic");
// Instantiate the Parser class
using (Parser parser = new Parser("input.xlsx"))
{
// Retrieve formatted text into the reader
using (TextReader reader = parser.GetFormattedText(
new FormattedTextOptions(FormattedTextMode.Html)))
{
// Output the formatted text from the document
// If formatted text extraction is not supported,
// the reader will be null
Console.WriteLine(reader == null ?
"Formatted text extraction isn't supported"
: reader.ReadToEnd());
Console.ReadLine();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment