Convert PDF to Excel

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.

You can either download the DLL of the API or install it using NuGet.

Install-Package GroupDocs.Conversion

Convert PDF to Excel using C#

You can convert PDF documents to Excel by following the simple steps given below:

  1. Set PdfLoadOptions if any apply.
  2. Set conversion options using SpreadsheetConvertOptions
  3. Create an instance of the Converter class
  4. Provide the file path and load options
  5. 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#.

Convert PDF to XLSX

Convert PDF to XLSX

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.

Conclusion

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.

See Also