ByteScout Invoice Parser SDK - C# - Parse Folder With Invoices To CSV - ByteScout

ByteScout Invoice Parser SDK – C# – Parse Folder With Invoices To CSV

  • Home
  • /
  • Articles
  • /
  • ByteScout Invoice Parser SDK – C# – Parse Folder With Invoices To CSV

How to parse folder with invoices to CSV in C# with ByteScout Invoice Parser SDK

Write code in C# to parse folder with invoices to CSV with this step-by-step tutorial

Learn how to parse folder with invoices to CSV in C# with this source code sample. ByteScout Invoice Parser SDK is the automatic invoice parsing engine and data extraction SDK. Relies on the built-in database and supports thousands of vendors out of the box! Can work offline and can detects and extract company name, invoice number, date, total amount to be paid and other fields. The database of supported invoices is updated on regular basis. Data output can be exported in JSON, XML, CSV formats or directly integrated with other apps. It can parse folder with invoices to CSV in C#.

This code snippet below for ByteScout Invoice Parser SDK works best when you need to quickly parse folder with invoices to CSV in your C# application. 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 Invoice Parser SDK in C# is also explained in the documentation included along with the product.

Trial version of ByteScout Invoice Parser SDK can be downloaded for free from our website. It also includes source code samples for C# and other programming languages.

Try ByteScout Invoice Parser SDK today: Get 60 Day Free Trial or sign up for Web API

Program.cs
      
using System; using System.Diagnostics; using System.Text; using ByteScout.InvoiceParser; namespace ParseFolderToCSV { class Program { static void Main(string[] args) { string inputFolder = @".\invoices"; string outputFile = @".\result.csv"; // Create InvoiceParser instance using (InvoiceParser parser = new InvoiceParser("demo", "demo")) { // Disable fallback to default generic template if document is nor recognized parser.FallbackToGenericTemplate = false; // Setup CSV output CSVOptions csvOptions = new CSVOptions { Encoding = Encoding.UTF8, SeparatorCharacter = ",", QuotationCharacter = "\"", UnwrapMultilineValues = true }; // Parse all document in input folder and save results to CSV file BatchProcessing.ParseFolderToCSV(parser, inputFolder, outputFile, csvOptions, ProcessingCallback); } // Open generated CSV file in default associated application (for demo purpose) Process.Start(outputFile); } /// <summary> /// Callback method to display progress and interrupt processing if needed. /// </summary> /// <param name="fileName">File name.</param> /// <param name="parsingResult">Parsing result.</param> /// <param name="progress">Current progress in percents.</param> /// <param name="innerException">Exception information in case of error.</param> /// <param name="cancel">Set to <c>true</c> to interrupt the batch processing.</param> static void ProcessingCallback(string fileName, bool parsingResult, double progress, Exception innerException, ref bool cancel) { Console.WriteLine({code}quot;{progress}% Processed file \"{fileName}\""); Console.WriteLine({code}quot; Result: {parsingResult}"); if (!parsingResult) { if (innerException != null) Console.WriteLine(innerException.ToString()); Console.Write("Continue processing? (y/n): "); int key = Console.Read(); if (key == 'n') { Console.WriteLine("Interrupted."); cancel = true; } } } } }

Try ByteScout Invoice Parser SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout Invoice Parser SDK page

Explore ByteScout Invoice Parser SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

prev
next