Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

#ERR The function call failed - Cannot skip more rows than are present

22 views
Skip to first unread message

Matthew Berry

unread,
Sep 25, 2023, 5:34:23 PM9/25/23
to xlSlim Support
Hi there,

I have a Python module that registers fine with xlSlim.

One of the python functions in that module always returns the following error when I call it from Excel:  "#ERR The function call failed - Cannot skip more rows than are present"

The same function works just fine when called from the Python file in the '__main__' block.

The function takes a DataFrame and returns DataFrame.  It is defined as follows:
def build_line_items(combinedNetworks:pd.DataFrame) -> pd.DataFrame:

When calling it from Excel, I pass it a cacheHandle to a DataFrame object.

Any ideas what causes this error, and how to avoid it?

Thanks!
Matt

xlSlim Dev

unread,
Sep 26, 2023, 5:09:14 AM9/26/23
to Matthew Berry, xlSlim Support
Hi,

That looks like you may be passing in an empty data frame. I would suggest verifying that the data frame is being created as expected in Excel. You could use the ViewPyObject() function for that.

Regards,
Russel 

--
You received this message because you are subscribed to the Google Groups "xlSlim Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xlslim-suppor...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/xlslim-support/d743e5b5-f46e-4c35-b572-dd32cf0eda55n%40googlegroups.com.

Matthew Berry

unread,
Sep 26, 2023, 5:44:20 AM9/26/23
to xlSlim Dev, xlSlim Support
Thanks. 

The object is cached as expected when inspected with ViewPyObject.

xlSlim Dev

unread,
Sep 26, 2023, 6:37:33 AM9/26/23
to Matthew Berry, xlSlim Support
That is curious, could you tell me how many rows and columns are in the data frame please?

Thanks,
Russel 
Message has been deleted

Matthew Berry

unread,
Sep 26, 2023, 9:06:14 AM9/26/23
to xlSlim Support
As verified with ViewPyObject(), the input DataFrame has:  
16 columns + the index
116 data rows + column header

Oddly, the same function does work if called with build_line_items_from_handle(cacheHandle)  version.

xlSlim Dev

unread,
Sep 26, 2023, 9:11:47 AM9/26/23
to Matthew Berry, xlSlim Support
Ah of course, I should have thought of that. Functions that accept a data frame can be called in two ways - a) passing in the data from an Excel range or b) passing in a handle to a cached data frame. a) uses the original function name and b) appends _from_handle to the function name. 

Regards,
Russel 

Matthew Berry

unread,
Sep 26, 2023, 9:13:50 AM9/26/23
to xlSlim Dev, xlSlim Support
So for any function that accepts as input ONLY a single DataFrame, do we have to use the _from_handle version for it to work properly?

xlSlim Dev

unread,
Sep 26, 2023, 9:28:58 AM9/26/23
to Matthew Berry, xlSlim Support

Matthew Berry

unread,
Sep 28, 2023, 11:13:56 AM9/28/23
to xlSlim Support
Yep, it's right there in the docs, as you noted.  Thank you!
Reply all
Reply to author
Forward
0 new messages