This may seem a bit strange but I’m planning to use a Google Sheet as a front end where users can type in inputs. Then, users can click the submit button to trigger a Prefect flow that will read the Gsheet’s inputs, transform it, then write it back onto the Gsheet. I’m wondering if anyone has tried something similar and can offer feedback on my approach:
1. We have a button in Gsheets that will activate a Google Apps Script to do an API call
2. The API call (hosted on AWS API Gateway) will trigger a Lambda function, which will trigger a Prefect flow
3. Prefect flow will read data in Gsheets, transform the data, then write data in Gsheets
Any suggestions or input is appreciated!
02/07/2022, 5:46 PM
There is an easier (and potentially more "robust") way to go about it. You could create a simple FastAPI backend API (that automatically ships with Swagger UI) that can have a POST request that accepts some JSON input and triggers a parametrized flow run via an API call. LMK if you'd like to get more resources about it
02/07/2022, 5:47 PM
Thanks for the response @Anna Geller, would love to get some resources to read up about this!
Could you also let me know why you think this could potentially be more robust than my initial approach?
For a bit of context, our company already has some internal APIs on AWS API Gateway which is why I initially chose that route.
02/07/2022, 6:06 PM
Why it's more robust (take it more just as an opinion/personal preference):
• because it's a standalone application that you can build in a clean way without hacking around Google Sheet with Google Apps Scripts and API Gateway (which is not the easiest thing to configure)
• you can have one clear API route that does this and a single place to troubleshoot if something goes wrong (rather than looking at whether GSheet, Google App Script or API Gateway caused the issue)
• you can additionally include auth with JWT token
• once you get new use cases, perhaps for other flows, it's easier to extend and adapt because it's all in code - you can easily add new API methods later
btw you can still deploy this FastAPI app to API Gateway if you want to. There is even a package called Mangum that adds an adapter to FastAPI to deploy it easily to AWS Lambda and API Gateway
02/07/2022, 7:18 PM
Amazing, thank you so much for the resources. I’ll give it a read, might come back with some more questions!