You can easily export tabular data from PDF files into Excel sheets (.xlsx or .xls) programmatically in your .NET application. Such conversion is useful when you need to edit data or need to apply various calculations available in Excel. In this article, you are going to learn how to convert PDF to Excel using C#.
The following topics shall be covered in this article:
C# API to Convert PDF to Excel
I will be using GroupDocs.Conversion for .NET API for the conversion of PDF to XLSX. This API provides a fast, efficient, and reliable file conversion solution into .NET applications without installing any external software. It also enables you to build powerful document conversion applications in C#, ASP.NET, and other .NET related technologies.
Convert PDF to Excel using C#
You can convert PDF documents to Excel by following the simple steps given below:
- Set PdfLoadOptions if any apply.
- Set conversion options using SpreadsheetConvertOptions
- Create an instance of the Converter class
- Provide the file path and load options
- Call the Convert method along with the output file path and convert options
The following code sample shows how to export tabular data from a PDF file into an Excel sheet using C#.
The PdfLoadOptions class provides various options for loading PDF documents. These properties include the FlattenAllFields, HidePdfAnnotations, Password, and RemoveEmbeddedFiles. You may find more details in the documentation.
The SpreadsheetConvertOptions class provides certain properties for converting files from other formats to Spreadsheet file type.
- The PageNumber property defines the starting page number of the source document to convert.
- The PagesCount property defines the total number of pages to be converted starting from PageNumber.
- You may convert specific pages by providing a list of page indexes to Pages property.
- You can set a password for the converted file using the Password property.
- The Zoom property can be used to set the zoom level in percentage for the converted file.
- The Format property defines the output format of the converted file.
You can find more details about “converting to a spreadsheet with advanced options” in the documentation.
Get a Free License
You can try the API without evaluation limitations by requesting a free temporary license.
In this article, you have learned how to export table data from PDF documents to Excel sheets using C#. You can learn even more about GroupDocs.Conversion .NET API using the documentation. In case of any ambiguity, please feel free to contact us on the forum.