Determine Number of Tabs in excel workbook

Options
Greg_703914
Greg_703914 Posts: 42
edited December 2019 in Questions

Does anyone know a way to count the number of tabs in an excel workbook? The reason I ask is I have an automation that extracts data from a specified area of each tab when the tab exists. In all instances at least one tab will exist but I need to determine how many tabs are in a workbook so I can determine how many times to have the "Save a spreadsheet to a table" action to run for each consecutive tab/sheet in the excel workbook. I saw a stack overflow article here:https://stackoverflow.com/questions/46033700/how-to-get-the-count-of-number-of-sheets-available-in-excel-file that outlines how Javascript can help with this. Can someone maybe help apply some script in the "Field Formulas" action? or have another way to accomplish creating an excel workbook sheet count variable?

Furthermore, It would be preferred if there was a way to use the variable defined above to assist in looping the "Save a spreadsheet to a table" action based on the number of tabs that are in a workbook, instead of creating 20+ actions in the automation for potential instances when they are needed. Please let me know if any additional information is needed or my explanation is not clear.

Best Answers

Answers

  • Greg_703914
    Greg_703914 Posts: 42
    edited December 2019
    Options

    The maximum number of columns each tab will have is 13 or through column M. The maximum number of rows will vary somewhere in between 40 to 334 on each tab. Most workbooks will be closer to 40 rows rather than 334 rows but in some rare cases you could see up to 334 rows. Do you think this will make the file too large if there are 20 tabs?

  • Greg_703914
    Options

    @Jozef_783863 your solution worked for me. Thank you. When the file gets too big the process lets me know. Hopefully this message goes away with the new excel platform that is currently being tested.