Language: Python (version 3.12)
Packages tried: OpenPyxl and Pandas
Task: Within a workbook I’m trying to find an instance of a specific year (input) within a column called “Year”. From there I’m trying to get the exact row value (integer), so I can update other columns in that row.
Unfortunately I can’t find a method to determine the row coordinate when entering the cell value I’m searching for. I’ve looked at pandas, but finding one where the year can be entered is not leading me anywhere. It seems pandas works great if you know the coordinate or total numbers of rows/columns, but not the coordinate of a specific cell based on a search criteria.
To expand:
I would like to search for an specific year (user input = 2023), so it will return the row coordinate. I want to then have the user fill out the amount paid, with which the program can then calculate the net pay for that year as well as the remaining amount and interest due the year after.
enter image description here
I’ve tried the code as found here: openpyxl module (Python): how can I get the coordinates of a cell when I know the string value of that cell?
However running it gets hung up on the [-1] within the following line:
_row_idx = _row_processor[-1]
Robert-Jan De groot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.