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:
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"); } } }
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
' 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."
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."
REM running the VBS through the command line cscript.exe PDFToXLS-CommandLine.vbs "../../sample3.pdf" "output.xls" pause