Automating Grist and Nextcloud takes no code: a ready-made scenario does the routine for you.
Starts when: Remove Background
Then: Get a record
Then: Code
Then: Split Out
Then: APImage API
Then: Download
Then: Upload file
You can launch this Grist + Nextcloud integration in Scriptera: describe the task in plain words — the scenario is built, launched and monitored for you.