How to Auto-Populate PDF Fields from an Excel Dropdown Selection
Question details
The user wants to automatically fill related PDF form fields when an item is selected from a dropdown menu that sources its data from an Excel spreadsheet.

- Product
- Adobe Acrobat / Microsoft Excel
- Device & OS
- not provided
- Scenario
- Building an interactive PDF form that relies on external spreadsheet data to dynamically populate dependent text fields based on a primary dropdown selection.
- Observed behavior
- Acrobat JavaScript cannot natively connect directly to a live Excel workbook, requiring data to be exported to plain text or hard-coded into the PDF to make the dynamic population work.
Ensure your Excel data is organized with clear column headers, and finalize the layout of your PDF form fields before applying custom document-level scripts.
Use Document-Level JavaScript in Acrobat
Since Acrobat cannot read Excel files directly, you must export your Excel data to plain text and hard-code it into a document-level script to act as the database.
PDF forms operate in a sandboxed environment and cannot query live Excel files via JavaScript. To achieve the auto-populate effect, the spreadsheet data must be converted into an array or JSON object inside the PDF's internal scripting engine.
Organize your Excel data so the dropdown values are in the first column and dependent field values are in subsequent columns. Concatenate this data into a JavaScript array format.
Open your PDF in Adobe Acrobat, navigate to Tools > JavaScript > Document JavaScripts. Create a new script named 'Data' and paste your formatted data array here.
Right-click the Dropdown field, go to Properties > Format, and choose 'Custom'. Enter a custom Keystroke script that uses the selected value to query your document-level array.
Within the same Keystroke script, use the getField() method to push the matched array values into the respective dependent text fields in your PDF.

Use Mail Merge for Static Document Generation
If you do not strictly need an interactive PDF form and just want populated PDF documents, using Mail Merge is much easier than writing custom JavaScript.
Use WPS Office to Seamlessly Merge Excel Data to PDF
Instead of writing complex JavaScript to link Excel and PDF forms, you can use WPS Office's built-in Mail Merge feature to automatically populate documents with spreadsheet data and batch-export them as PDFs.
- 1. Open your template: Launch WPS Writer and open the document template that requires the data fields.
- 2. Connect the spreadsheet: Navigate to the References tab, click Mail Merge, and select 'Open Data Source' to import your WPS Spreadsheet or Microsoft Excel file.
- 3. Insert fields: Use the 'Insert Merge Field' button to place your dynamic data points into the document.
- 4. Export to PDF: Click the 'Merge to PDF' option on the ribbon to automatically generate a batch of customized PDF files.

Frequently Asked Questions
Can Adobe Acrobat connect directly to a live Excel file?
No, Acrobat JavaScript cannot directly query a live Excel workbook due to security restrictions. You must export the Excel data to a structured format like plain-text, CSV, or hard-code it into a document script.
Why won't my dependent PDF fields update when I change the dropdown?
This usually happens because the dropdown selection isn't immediately triggering the script. Right-click the dropdown, select Properties, go to the Options tab, and check 'Commit selected value immediately'.
Are there automated tools for populating PDF fields from Excel?
Yes. If you prefer not to write JavaScript, there are third-party Acrobat plugins and standalone automation tools designed specifically to map plain-text or CSV data to PDF form fields.
What is the best alternative if I don't know JavaScript?
The easiest alternative is using the Mail Merge feature in a word processor like WPS Writer or Microsoft Word. You can link your Excel sheet to a template and directly export the populated results as PDF files.




