Search code examples
javascriptdelphibrowsergoogle-sheetsdelphi-7

Passing data from browser Javascript to Delphi application


I have a Google Sheets document containing invoicing data and an invoicing software written in Delphi 7.

What I'd like to achieve is to pass invoice data from the selected row in the sheet to the invoicing software. In order to do this, I plan to implement a simple javascript in the Google Sheet document.

The question is: is it possible for this in-browser javascript to pass data to my invoicing software?


Solution

  • A simple solution would be to have the invoicing software start a small webserver that can take Cross-Origin-AJAX requests from the the JavaScript in the browser. This way the JavaScript could just send an POST request to e.g. http://localhost:8080/invoice

    Another method would be to have register the invoicing software with a custom protocol and have the JavaScript open a new tab with that protocol and the data encoded into the URL. (How to do this on Windows)

    If the invoicing software is not under your control, which I assumed, then neither of these approaches will work unless the software does already support this.