Skip to main content
Best answer

How do I reliably expose the contents of an email attachment (Word or Excel) to ChatGPT?

  • 13 June 2024
  • 3 replies
  • 116 views

I am building a Zap, one of the steps is to use the contents of an email attachment (Word or Excel) in a conversation step with ChatGPT.

I constantly ran into the error ‘unable to open external links’

I have read these articles:

I eventually found the following workaround — using Zapier:

  1. New email trigger - match search;
  2. Save the attachment as a new file to Google Drive — convert the file to Google Docs (NB);
  3. Find the file in Google Drive;
  4. Use Zapier’s Text From File action and use the text version of the file in step 3;
  5. Use the output from 4 in conversation with ChatGPT and extract information to JSON format for further processing

The above is not robust enough for a production solution, however may be sufficient for a demo. I am looking for a reliable method of extracting the contents of a Word or Excel document to use in an OpenAI conversation.

If possible, not to use services such as Docparser or PDF.co.

In playing around, I discovered I could save the file to OpenAI as a vector store. It seems Zapier can access existing assistants in OpenAI, this is all new territory for me.

I am also looking at Singlestore, having watched a webinar that uses Zapier Central to query a file in Singlestore.

Any advice on this is greatly appreciated. Specifically, how to reliably expose the contents of a Word or Excel document to ChatGPT. Pointers to tutorials will be greatly appreciated.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +11

Welcome to the Community, @Patrick Michael! 😁

The New Document in Folder (Google Docs) trigger has a File Raw Plaintext Content field that would contain the text from the Google Docs so perhaps a more efficient and reliable way of extracting the content would be to split this up into two Zaps as follows:
 

Zap 1 - uploads attachments into a specific folder

  • Trigger: New Attachment (Gmail) - runs when there an attachment for emails matching certain search criteria.
  • Action: Upload file (Google Drive) - uploads the Google Doc attachment into a specific folder.

 

Zap 2 - passes the file to ChatGPT and converts extracted information into JSON

  • Trigger: New File in Folder (Google Docs) - runs when there’s new file added into a specific folder.
  • Action: Conversation With Assistant (ChatGPT) - Takes the content of the Google Document contained in the File Raw Plaintext Content field and extracts it as JSON.
  • Action: ?? - Not entirely sure what you’d like to do with the extracted JSON. Presumably it would it then be used in a Webhooks by Zapier action

 

Do you think that approach would work for your needs here? If I've misunderstood what you're looking to do or you run into any issues in setting this up just let us know. Always happy to help further! 🙂

Hello @SamB , thank you for the reply.


Yes, what you are suggesting is exactly what I am currently doing. I am using the Raw Text file in the conversation with GPT and extracting as JSON.

 

The process works well for documents that have simple plain text content and even simple tables.


The documents I am working with have complex tables and the semantic relationships between labels and values gets a bit lost in the raw text version.

 

As such, the JSON extracted has discrepancies and omissions.

 

We will propose using web forms to replace the documents. This will be a much more reliable approach.

 

Again, thanks for the reply.

Userlevel 7
Badge +11

Ah, I see! Using web forms to replace existing Google Documents sounds like a great alternative @Patrick Michael! 🙌

Seems like you’re all set for now with that approach but if anything changes or if you need anything else please do reach out. In the meantime, happy Zapping! 😁⚡