Skip to main content
August 28, 2025
Question

count the number of excel Sheets

  • August 28, 2025
  • 3 replies
  • 0 views

In the interface user has privilege to upload the excel document, we are using the function readexcelsheetpaging to get the information from the 4th sheet of the uploaded excel. when the user uploads the excel with sheets < 4 expression error is shown. Is there a way to check the number of sheets in the excel uploaded  before passing it to readexcelsheetpaging function?

    3 replies

    shubhama926776
    August 28, 2025

    AFAIK, No plugins or built-in functions exist to check sheet count/metadata before reading, making pre-validation impossible.
    Use defensive UI design, Warn users clearly and get confirmation before attempting to read sheet 4. This way, if error occurs, user understands why.

    readexcelsheetpaging() throws a Java exception when accessing non-existent sheets, which cannot be caught in interfaces without try() function.
    However, Appian does not officially support this function as it's hidden. It is recommended to check with your organization or Appian Support before using it in Production.

    harshas2775
    August 29, 2025

    Generally for scenarios like these I prefer to add validation in the excel template itself so that users cannot save the file unless they have filled data as per requirement. Its generally is easy as well with or without macros. 
    Assuming you are providing the users with a template to work with easiest will be to Protect the worksheet so that users cannot delete the sheet. Excel functions like SHEET() etc can help in saving and fetching sheet count from excel workbook as well.

    More details will enable me to help you better. Meanwhile explore excel validations instead of Appian ones for your usecase.

    Known Participant
    September 3, 2025

    To check the number of sheets in the excel uploaded you can use this plugin
    document-page-counter