How to Validate Acrobat Form Data Using an External CSV File
Question details
The user needs to validate PDF form fields (such as job and employee numbers) against a daily-updated CSV file stored on an FTP site.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Attempting to populate and validate dynamic field form data using an external database or CSV file hosted on an FTP server.
- Observed behavior
- Acrobat JavaScript cannot natively access or retrieve external CSV files directly via FTP for form validation.
Ensure you have basic knowledge of Acrobat JavaScript and verify whether your server infrastructure supports standard HTTP/HTTPS access, as FTP is not supported for these operations.
Embed the CSV File Directly into the PDF
By attaching the CSV file to the PDF itself, you bypass the need for external network access and can use JavaScript to read the data internally.
This method is the most reliable way to ensure the PDF has access to the validation data without running into network security restrictions or requiring complex folder-level scripts. It works best if the CSV file size is relatively small.
Open your PDF form in Adobe Acrobat, navigate to the 'Attachments' panel (usually on the left sidebar), click 'Add a new attachment', and select your daily exported CSV file.
Go to 'Tools' > 'JavaScript' > 'Document JavaScripts'. Create a new script to parse the attached CSV file's data object using the `this.getDataObjectContents()` method.
Right-click your job or employee number form field, select 'Properties', go to the 'Validate' tab, and set up a custom validation script that references your parsed CSV data array to check for a match.

Retrieve CSV Data via HTTP Operations
If the data must remain external and dynamic, use a standard HTTP request instead of FTP to fetch the CSV file.
Implement Server-Based Form Validation
For secure, enterprise-level validation, process the PDF form submission on a web server rather than within the PDF client.
Looking for a Lightweight PDF and Office Suite?
While advanced server-side PDF scripting requires specialized enterprise tools, WPS Office provides a comprehensive, lightweight, and free alternative for everyday PDF editing, form filling, and document management. Experience seamless compatibility with major Office formats and a familiar user interface without the heavy subscription costs.

Frequently Asked Questions
Can I use FTP to fetch external data in Acrobat JavaScript?
No, Acrobat JavaScript does not support fetching external files directly via FTP for security reasons. You must use HTTP/HTTPS operations via folder-level scripts or embed the data directly into the PDF.
What is a folder-level script in Adobe Acrobat?
A folder-level script is a JavaScript file placed in a specific Acrobat application directory on the user's local machine. It runs with elevated privileges, allowing it to perform network actions (like HTTP requests) that standard document-level scripts cannot.
How can I securely validate PDF form fields against a database?
Instead of connecting the PDF directly to a database or exposing CSV files, the best practice is to submit the form data to a secure web server. The server can then query the database or CSV file and handle the validation logic externally.
Is it safe to embed a CSV file with employee data into a PDF?
Embedding a CSV with sensitive employee data directly into a PDF can expose that information to anyone who opens or extracts files from the PDF. If the data is sensitive, it is highly recommended to use secure server-side validation instead.




