5 Replies Latest reply: May 27, 2016 4:27 AM by Colin Albert RSS

    Load an excel sheet only if the sheet exists

    annick whitfield

      Hello,

       

      I would like to load data from an excel file (sales.xlsx) with several optional sheets (Year, Month). In case a sheet does not exist I want the script to continue and I don't want errors to be raised.

       

      This is my load script:

       

      set ErrorMode = 0;

       

      YearSales:

      LOAD

          Year

          SalesPerYear

      FROM [$(vConfigPath)sales.xlsx]

      (ooxml, embedded labels, table is Year);

       

      MonthSales:

      LOAD

          Month

          SalesPerMonth

      FROM [$(vConfigPath)sales.xlsx]

      (ooxml, embedded labels, table is Month);

       

      set ErrorMode = 1;


      As expected the script does not exist in case a sheet (e.g Year) does not exist, and the APP gets saved successfully.

      However I get this error:

       

       

      Is there a way to avoid these errors?

       

      Many thanks

      KInd Regards