How to convert PDF to XLS in C#, VB.NET, and VBScript using PDF Extractor SDK - 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!

How to convert PDF to XLS in C#, VB.NET, and VBScript using PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • How to convert PDF to XLS in C#, VB.NET, and VBScript using PDF Extractor SDK

ByteScout PDF Extractor SDK can be used to convert PDF documents to XLS in C#, VB.NET, and VBScript. Use corresponding source code samples below for PDF to XLS conversion.

It is also possible to convert PDF to XML or CSV.

Select your programming language:

How to convert PDF to XLS in C#

using System.IO;
using Bytescout.PDFExtractor;
using System.Diagnostics;

namespace PDF2CSV2XLS
{

    class Program
    {
        static void Main(string[] args)
        {
            // Create Bytescout.PDFExtractor.XLSExtractor instance
            XLSExtractor extractor = new XLSExtractor();
            extractor.RegistrationName = "demo";
            extractor.RegistrationKey = "demo";

			File.Delete("output.xls");

            // Load sample PDF document
            extractor.LoadDocumentFromFile("sample3.pdf");
			
			// Save the spreadsheet to file
			extractor.SaveToXLSFile("output.xls");

			// Open the spreadsheet in default associated application
            Process.Start("output.xls");
        }
    }
}

How to convert PDF to XLS in Visual Basic .NET

Imports System.IO
Imports Bytescout.PDFExtractor
Imports System.Diagnostics

Class Program
	Friend Shared Sub Main(args As String())

        ' Create Bytescout.PDFExtractor.XLSExtractor instance

		Dim extractor As New XLSExtractor()
		extractor.RegistrationName = "demo"
		extractor.RegistrationKey = "demo"

		File.Delete("output.xls")

		' Load sample PDF document
		extractor.LoadDocumentFromFile("sample3.pdf")

		' Save the spreadsheet to file
        extractor.SaveToXLSFile("output.xls")

		' Open the spreadsheet in default associated application
		Process.Start("output.xls")
	End Sub
End Class

How to convert PDF to XLS in VBScript (Visual Basic 6)

' Create Bytescout.PDFExtractor.XLSExtractor object
Set extractor = CreateObject("Bytescout.PDFExtractor.XLSExtractor")

extractor.RegistrationName = "demo"
extractor.RegistrationKey = "demo"

' Load sample PDF document
extractor.LoadDocumentFromFile "../../sample3.pdf"

extractor.SaveToXLSFile "output.XLS"

MsgBox "Data has been extracted to 'output.XLS' file."

How to convert PDF to XLS running a VBScript file through the command line

1.VBScript file PDFToXLS-CommandLine.vbs

if Wscript.Arguments.Length < 2 Then
 WScript.Echo "Usage: PDFToXLS.vbs ""input.PDF"" ""output.XLS"""
 WScript.Quit
End If

' Create Bytescout.PDFExtractor.XLSExtractor object
Set extractor = CreateObject("Bytescout.PDFExtractor.XLSExtractor")

extractor.RegistrationName = "demo"
extractor.RegistrationKey = "demo"

WScript.Echo "Loading file from " & WScript.Arguments.Item(0)
' Load sample PDF document
extractor.LoadDocumentFromFile WScript.Arguments.Item(0)

WScript.Echo "Saving file to " & WScript.Arguments.Item(1)
extractor.SaveToXLSFile WScript.Arguments.Item(1)

WScript.Echo "Success: Data has been extracted to '" & WScript.Arguments.Item(1) & "' file."

2. .bat file code to run the .vbs file

REM running the VBS through the command line
cscript.exe PDFToXLS-CommandLine.vbs "../../sample3.pdf" "output.xls"
pause

Tutorials:

prev
next