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.

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.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")) { // 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; } } } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Invoice Parser SDK Home Page

Explore ByteScout Invoice Parser SDK Documentation

Explore Samples

Sign Up for ByteScout Invoice Parser 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 Invoice Parser SDK Home Page

Explore ByteScout Invoice Parser SDK Documentation

Explore Samples

Sign Up for ByteScout Invoice Parser SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

prev
next