how to get current active cell in google spreadsheet for my chrome extension?

I am not able to do get current active cell from DOM.
More specifically I need the row number from the active cell.
I have tried to do this by writing a google app script

function doGet() { 
  const activeRowNumber = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getActiveCell().getRow();
  const result = {
    activeRowNumber: activeRowNumber
  }
  return JSON.stringify(result)
}

which works fine and returns the active cell row number, but the problem is when I deploy it as a web app or API executable to make it possible to run it on any google spreadsheet from my chrome extension. When I make the REST API request, it always returns 1

my question is very related to Get ActiveCell of Google Sheet client side

Is there some way how can I achieve this?
Please let me know.

My idea for an ugly workaround is to create a google spreadsheet Add-on, deploy it to the chrome store for add-ons. Make the user of my chrome extension install this spreadsheets add-on so the add-on can communicate somehow with my chrome extension, to push data about current active cell row number to my chrome extension. Would such communication be possible without using some external database or API?

How to insert a data in Google sheets using Chrome extension?

I’m trying to insert a data in Google sheets from extension..

I tried the chrome extension but I couldn’t call Google sheet from the extension.

Please post some ideas