Input form to prompt to document

Hi:
I’m new to using Chatgpt and Api’s.
Here’s what I want to do…

  1. create a form and post it to collect some information such as name, email, request for certain information
  2. using the input information, create a prompt (or some other method) to get the information
  3. using the response, create a word document or pdf and send it back to the user (name, email)

Sounds easy enough but I’ve run into some roadblocks. I want to make this a fully automated process with no manual intervention at all. I’ve been playing around with Create a GPT in Chatgpt 4.

Is there a better way to get this done?

TIA,
Anne

1 Like

Lots of ways you can do this, but I’ll try to keep it “relatively” simple since I’m not sure of your Python API level of experience, I apologize in advance if this is way too complex or overkill, but its a method I just recently used for a similar project.

  1. You can create the form with Google Forms and then it should export to Google Sheets, you could then make a call to read the data from Google Sheets in Python: Python quickstart  |  Google Sheets  |  Google for Developers

I personally used gspread to grab the data:

(I have my script checking once a day or once a week, but technically you could use Google App Scripts to have the spreadsheet trigger your py script on every new upload)

  1. Once you have that data, you would put it into a prompt using f-string literal, injecting it, and then pass that to the gpt api with instructions.

  2. To create a pdf or word doc, you could either do it yourself with the reply back using python-docx or pypdf2 OR have an OpenAI Assistant do it for you if you give it access to the code-interpreter tool.

Hopefully that helps give you a starting point. :slight_smile:

1 Like

If you’re super new to programming/apis, then you may want to consider using something like Zapier to connect these steps together.

1 Like