Running python scripts from Coda, writing output to Coda?

Is there a way to trigger a Python script from within Coda?

I have written a couple of Python scripts that scrape the web to get additional columns of info for a couple of tables in my Coda doc. At the moment I export a Coda table to CSV as my input and then import the csv output back into Coda. Ideally I would have a button within Coda that lets me run the scripts from within Coda, provide the input to Python from Coda, and then pull the script results directly back into my table.

Any thoughts on how to approach this? I should note that I am a total Python novice (muddling my way through with a lot of help from GPT!) but I am an advanced Coda user, have just about finished building my first (basic!) Coda pack, and am very comfortable using 3rd party API integration tools like Make.com (which will probably be my fallback strategy if I can’t do this all from within Coda.)

Thanks in advance for any suggestions.

I fear there are numerous aspects of your business requirements missing. However, this sounds like a process that you may benefit from Bardeen which can scrape just about anything and post data directly into Coda over HTTP webhooks. This article exposes the general idea posting scraped data into Mem.

If you aren’t skilled at Python, I would avoid trying to build your process in Python. If you like no/low-code tools, Bardeen is that and it provides some very powerful scraping technology.

Hi @Alexandra_Samuel - Unfortunately this wouldn’t be so straightforward to accomplish. Coda Packs are the best way to integrate custom actions into Coda, but they only support JavaScript / TypeScript, not Python. You could host your Python script on some cloud service (AWS Lambda, Google Cloud Functions, etc) and then have a Pack send a request to that service to run it. You could also use the Coda API to allow your Python script to read and write to the Coda tables directly.

If you aren’t particularly tied to Python then I’d consider implementing your solution in a Pack instead, since it’s the best way to integrate with a Coda doc and doesn’t require you to pay for hosting.

But, this is possible, albeit, perhaps not wise. :wink: