Skip to content

GPT_FILE formula

Ask a question about a file with =GPT_FILE

Section titled “Ask a question about a file with =GPT_FILE”

=GPT_FILE fetches a file from a URL and answers your prompt from its content: summarize a PDF contract, extract the total of an invoice image, transcribe the subject of an audio message, read a DOCX.

=GPT_FILE(prompt, fileURL, temperature, model)

Parameter Description Default
prompt What to do with the file (ex: “What is the total amount of this invoice?”). Required
fileURL A cell with the URL, or the URL in quotes. The file must be downloadable without signing in: a public link, a Google Drive file shared with “Anyone with the link”, or a direct file URL. Required
temperature Between 0 (not creative) and 2 (very creative) 0.5
model standard or advanced (paid plans). Used for the document-search route standard

Example: =GPT_FILE("Summarize this document in three bullet points", A2)

The GPT_FILE formula and its result in a sheet

Format How it is read
PDF up to 20 pages Read whole by a multimodal model
Images (png, jpg, webp) up to 20 MB Read whole by a multimodal model
Audio (mp3) and video (mp4) up to 20 MB Read whole by a multimodal model
PDF over 20 pages Indexed, then the most relevant passages are searched with your prompt
Word (docx), PowerPoint (pptx), txt, md, csv, json, html, code files Indexed, then searched

For indexed files the passages given to the model are capped at about 16,000 characters, so a question about a specific section works better than “summarize everything” on a very long document.

  • Media file is too large for GPT_FILE (max 20MB): compress the image, audio or video, or split it.
  • Failed to index file for search (…): the file could not be read; check that the URL downloads the file directly and that the format is supported.
  • A sign-in page or HTML instead of the file: the link is not public. Share the file with “Anyone with the link” or use a direct download URL.

Credits are charged at the model’s actual cost of the file and the answer, see What is a credit?.