Find answers from the community

Updated 2 months ago

I am currently using agent with PandasQueryEngine as a tool for reading excel file. It can

I am currently using agent with PandasQueryEngine as a tool for reading excel file. It can read information from whatever is available in the file. But is there a way so that it can also read a formula that is available in the excel file ?
k
i
5 comments
Please stand by @ihshan :) as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
I'm sorry, but based on the information provided in the knowledge sources, there's no explicit mention of the ability to read formulas from Excel files using the PandasExcelReader class in LlamaIndex. The PandasExcelReader class uses the read_excel function from the pandas library to parse Excel files, and this function typically reads the values of cells, not the formulas.

However, you might be able to achieve this by using the read_excel function with specific parameters. You would need to refer to the pandas documentation for more details on this.

Here is the basic usage of the PandasExcelReader class:

Plain Text
class PandasExcelReader(BaseReader):
    def __init__(
        self,
        *args: Any,
        concat_rows: bool = True,
        sheet_name=None,
        pandas_config: dict = {},
        **kwargs: Any
    ) -> None:
        super().__init__(*args, **kwargs)
        self._concat_rows = concat_rows
        self._sheet_name = sheet_name
        self._pandas_config = pandas_config

You can find more details about the PandasExcelReader class in the LlamaIndex documentation ().

For more advanced usage or specific needs, you might need to extend the PandasExcelReader class or create a custom reader.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
@kapa.ai So basically, it does not pick up formula right by default when I am using pandasqueryengin
Let me check the knowledge base for you. One moment! :books:
----------------------
Correct, by default, the PandasExcelReader class in LlamaIndex, which uses the read_excel function from the pandas library, reads the values of cells in an Excel file, not the formulas. This is a standard behavior of the read_excel function.

Here's the basic usage of the PandasExcelReader:

Plain Text
class PandasExcelReader(BaseReader):
    def __init__(
        self,
        *args: Any,
        concat_rows: bool = True,
        sheet_name=None,
        pandas_config: dict = {},
        **kwargs: Any
    ) -> None:
        super().__init__(*args, **kwargs)
        self._concat_rows = concat_rows
        self._sheet_name = sheet_name
        self._pandas_config = pandas_config


If you need to read formulas from an Excel file, you might need to use a different tool or library that supports this feature, or extend the PandasExcelReader class to add this functionality.

You can find more details about the PandasExcelReader class in the LlamaIndex documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord