Index the contents of Excel files

To be able to index the contents of .xlsx files you must create a text extractor that gets the data from published .xlsx files and adds it to a search index.

Perform the following:

  1. Open your project in Visual Studio.
  2. In the Solution Explorer, expand References and navigate to Telerik.Windows.Documents assembly.
  3. Copy and save the version of the assembly.
  4. In Visual Studio, add the Telerik NuGet server as described in Available NuGet Packages » Get the NuGet Packages.
  5. In your project, install Telerik Document Processing Spreadsheet NuGet package.
    To do this, open the Package Manager Console and use the following command to install the following NuGet package from the Telerik Document Processing NuGet repository:
    Install-Package Telerik.Windows.Documents.Spreadsheet -Version X
    Where X is the assembly version you got in Step 3.
    EXAMPLE: Install-Package Telerik.Windows.Documents.Spreadsheet -Version 2023.1.123.45
  6. Build the project and open it.
  7. Add the XlsxTextExtractor class to your project.
  8. Use the following steps that guide you through the implementation of the class:
    1. Inherit from ITextExtractor.
    2. Define the private members.
    3. Get the mime type.
    4. Implement the GetText method of XlsxTextExtractor class.
    5. Implement the private method ExecuteDocumentAction.

      EXAMPLE: For more information, see the XlsxTextExtractor.cs class the in Sitefinity's CMS documentation-samples GitHub repository.

  9. In Sitefinity CMS backend, navigate to Administration » Settings » Advanced » DocumentService » ExtractorSettings » Create new.
  10. In MimeType field, enter application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  11. In ExtractorType field, enter SitefinityWebApp.XlsxTextExtractor, SitefinityWebApp
  12. Save your changes and restart the application.
  13. Create a search index for documents and reindex it.
    For more information, see Create search indexes.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?