◉GEMINI LABJP
●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 7 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 7 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…
Articles/Workspace
◧ Workspace/2026-10-15Beginner

Keeping a Gemini Answer as a Dated PDF — Export to Docs, Then Freeze It with Apps Script

Gemini's Share & export menu has no PDF option. Here is how to export to Docs, freeze a dated PDF next to it with Apps Script, and avoid the getAs() file-naming trap.

Gemini91Google Docs4Apps Script13PDF3Google Drive5

Say you have spent an hour with Gemini polishing the store description for an app, and the draft finally reads the way you want. Before it goes to a client, you would like to keep "the version as of today." You open Share & export under the answer and find Docs, a Gmail draft, Sheets for tables, Colab and Replit for code. No PDF.

A Zenn article comparing how ChatGPT, Claude, and Gemini let you turn a conversation into a document, based on each vendor's help pages, made the same observation: PDF is the one option missing from all three. Anyone who drafts submission material with an AI as an indie developer is likely to run into the same spot.

So I reread the official help and reference pages and put together a small way to freeze a PDF through Docs. One thing up front: the Apps Script part has been checked as logic against a mock of the Apps Script services, not run on a real Google account. I describe that boundary at the end.

What the official pages say (checked 2026-10-15)

The Gemini Apps Help has two relevant passages.

The "Export responses" page lists Docs, a Gmail draft, Sheets for responses that contain a table, and Colab or Replit for code, all under Share & export. Exporting to Docs "saves a new doc in Google Drive."

The "Use Gemini Apps" page has a section on generating files from a chat. You ask for a response in a supported file type, and the list of supported formats includes .pdf alongside Docs, Sheets, .docx, .xlsx, and .csv.

So a missing menu entry and an inability to make PDFs are two different things. The Zenn article is right about the Share & export path; asking Gemini to produce a PDF is a second route on top of it.

Decide why you want the PDF first

Before choosing a tool, it helps to say in one line what the PDF is for. I see three reasons:

  • To freeze the content at the moment you hand it over. A Docs link always shows the latest version, so later edits reach the other person too.
  • To be able to go back to "the draft from that day." With the date in the file name, opening the folder tells you the order.
  • To separate the sharing scope from the original document. A PDF is its own file, so you can pass it on without widening the original's sharing settings.

If none of these applies, leaving it as a Doc is the least effort.

Three routes side by side

RouteEffortGood forWatch out for
Ask Gemini to produce a PDFOne extra phrase in the promptA one-off where you do not mind how it looksYou rename and file the result yourself
Export to Docs, then File → Download → PDFA few clicksWhen you want to edit after exportingThe file lands in your Downloads folder, away from the source
Export to Docs, then freeze with Apps ScriptAbout five minutes of setupA repeated task where you want a historyIt needs Drive authorization

For a single use, the first two are enough. The third pays off if you repeat the same cycle every week: draft a proposal with Gemini, then keep the version you actually sent.

Export to Docs, then freeze with a date

Export the answer to Docs from Share & export, open that document, and choose Extensions → Apps Script. Paste the code below and save, and a "PDF で固定" (Freeze as PDF) menu appears in Docs.

The code solves two problems: gathering PDFs next to the source document, and putting a timestamp in the name so versions are not overwritten or mixed up.

/**
 * Turns a Doc exported from Gemini into a dated PDF and places it
 * in a "PDF" folder next to the source (run from the Docs menu).
 */
const PDF_FOLDER_NAME = 'PDF';
 
function onOpen() {
  DocumentApp.getUi()
    .createMenu('Freeze as PDF')
    .addItem('Create dated PDF', 'exportDocAsDatedPdf')
    .addToUi();
}
 
function exportDocAsDatedPdf() {
  const doc = DocumentApp.getActiveDocument();
  const file = DriveApp.getFileById(doc.getId());
  const stamp = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), 'yyyy-MM-dd_HHmm');
 
  // Ignore the name getAs() assigns; decide the final name ourselves
  const blob = file.getAs(MimeType.PDF).setName(buildPdfName(doc.getName(), stamp));
 
  const folder = getOrCreateFolder_(file, PDF_FOLDER_NAME);
  const pdf = folder.createFile(blob);
 
  const ui = DocumentApp.getUi();
  ui.alert('PDF created', folder.getName() + ' / ' + pdf.getName(), ui.ButtonSet.OK);
}
 
function buildPdfName(docTitle, stamp) {
  const base = String(docTitle).replace(/[\\/:*?"<>|]/g, '_').trim() || 'untitled';
  return base + '_' + stamp + '.pdf';
}
 
function getOrCreateFolder_(file, name) {
  const parents = file.getParents();
  const parent = parents.hasNext() ? parents.next() : DriveApp.getRootFolder();
  const found = parent.getFoldersByName(name);
  return found.hasNext() ? found.next() : parent.createFolder(name);
}

Here is why it is written this way.

The timestamp format yyyy-MM-dd_HHmm sorts chronologically as plain text. Minutes are included because you may freeze several drafts in a day. Running it twice in the same minute produces two files with the same name; Drive allows that, so nothing fails.

The trailing underscore on getOrCreateFolder_ is the Apps Script convention for a private helper that does not appear in the menu or the run list. It creates the PDF folder once and reuses it afterwards.

buildPdfName swaps characters that are not safe in file names for _ and falls back to untitled if the title is empty.

The naming trap

The obvious first version passes the Blob from getAs(MimeType.PDF) straight to createFile. The official reference for getAs contains a sentence worth reading twice:

It assumes that the part of the filename that follows the last period (if any) is an existing extension that should be replaced. Consequently, "ShoppingList.12.25.2014" becomes "ShoppingList.12.25.pdf".

If you like dates written with periods, a document titled "2026.10.15 Minutes" would, by that rule, come out as "2026.10.pdf". The day and the title both vanish, and the name can collide with another document from the same month.

There are two defenses. Separate dates with - or _. And call setName after getAs, as the code does, so the final name is yours regardless of periods in the title. Either one alone helps; together they leave nothing to chance.

Before you run it

The first run shows an authorization screen. The script reads a Drive file and writes into a folder, and the reference lists https://www.googleapis.com/auth/drive for these calls. A read-only scope is not enough for createFile.

If it is your own script on your own document, you decide what to accept. If you share or copy a document that contains the script, though, the next person is asked for the same approval. For ways to keep scopes narrow, see Keeping Apps Script × Gemini Automation Permissions Minimal.

Also note that the PDF folder is created under the same parent as the source document. If that parent is shared with other people, sharing in Drive extends to what is inside it. If the frozen PDFs are meant to be pre-send drafts, look at the parent folder's sharing first. A related angle, how far Gemini itself can read into Drive, is covered in Before Unsharing Drive from Gemini, Try This Setting.

What was checked, and what was not

Checked: two pages of the official help (exporting responses, generating files) and the Apps Script reference for File.getAs and Folder.createFile. I also ran the code in Node.js against stand-ins for the Apps Script services and confirmed that exactly one folder is created, that PDFs accumulate in it, and that titles with special characters or an empty title produce the expected names.

Not checked: a run on a real Google account. The wording of the consent screen, the title of the exported Doc, and how tables or images look in the PDF are things to see for yourself. Try it first on a document you do not mind losing.

My rule of thumb

What I send to someone else is a separate, dated file, not a Docs link. A link is convenient, but from the moment I hand it over, the other person's screen follows my edits. A PDF is less convenient exactly because it stops moving.

To get started, press the menu once on an exported Doc and look at what appears in the PDF folder. Adjust the naming format to your own filing afterwards.

If you also track Gemini usage from Sheets, Working Out a Monthly Gemini Bill from Sheets Across a Year-End Price Change describes a ledger approach in Apps Script.

Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

◧ Workspace2026-08-27
Meet Notes Now Covers In-Person Meetings. Decide Where They Land in Drive First
Google Meet note-taking can now start from the home screen and covers in-person meetings. Here is how to set up a single Drive intake folder before the docs scatter, and pull only the decisions into a ledger with Apps Script.
◧ Workspace2026-09-17
Gem sharing stops in three places: the order I check when a shared Gem never shows up
When a shared Gem never reaches the other person, the block sits in the Gem itself, in the Admin console, or in Drive. Here is what stops where, who can unblock it, and the order I check.
◧ Workspace2026-09-01
When a New Gemini Feature Hasn't Reached Your Workspace, Here's How to Tell Waiting From Broken
A step-by-step way to decide whether a missing Gemini feature in Google Workspace is still rolling out or actually misconfigured, using release tracks and rollout pace, plus a small Apps Script ledger that does the counting for you.