These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

can you import data into form fields from a spread sheet

phorsley
Registered: Nov 2 2007
Posts: 35

We have been supplied a PDF with form fields and a excel spreadsheet with data,
is it possible to import the data into the form fields, or is it a matter of cut and paste.

thanks

My Product Information:
Acrobat Pro 9.2, Macintosh
mmazal
Registered: Jul 20 2009
Posts: 27
you can import using a batch file and if you are using Acrobat Pro

what I do is save the Excel file as comma delimited text with headers

on the pdf the text fields must have the same name as the headers (but can be formatted however you like ie decimals, font, dd-mm-yy, etc)

build the batch file using the importTextData command with the data file

theres a good example in the reference

I'd paste it here for you but it's not letting me

my code loops through importing each row and does a saveAs to create a new file for each row


good luck
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There are at least 3 methods for doing this.

The first method is to export the data from the Excel file as a Tab Delimited file. In order for Acrobat to be able to read the data it must have the correct line endings. On Windows it has be saved out of Excel using he "Text(MS-DOS)" Save as Type option. Since you are on a Mac I don't know which option will work. Try both.

After the file is exported, select the "Forms > Manage Form Data > Import Data..." menu item. From here you can select the ".txt" file you exported from excel and then a specific line from the file. This method works for importing a single record at a time, and you'll also need to use it to validate that the ".txt" format is correct. As mmazal stated, the header names must exactly match the form field names.You can also do pretty much the same thing using the "doc.importTextData()" JavaScript function. In fact you can write an automation or batch script that will import each record and generate or print a new document as mmazal has suggested.

The 3rd method is to use the ADBC object in Acrobat JavaScript to import data directly from the original Excel file. However this methodology requires a bit more complex scripting and only works on
Windows platforms.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

scderacjor
Registered: Mar 27 2009
Posts: 123
Can you point me towards a tutorial, good sample, or detailed description of how to do the process mmazal suggested?

I have been looking into how to do this (it sounds similar to MS Word "mail merge" function, right?). I am a very beginner, and don't even know what "tab delimited file" means.

Thank you both for your help.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Here is a basic explaination of importing and exporting data from/to an Excel file. It's a membership site, so if you are a member there are also scripts and explainations on how to do it.

http://www.pdfscripting.com/public/department48.cfm

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

scderacjor
Registered: Mar 27 2009
Posts: 123
This entire sentence is frustrating to me: "The ADBC object uses the Windows ODBC mechanism to communicate with a database through SQL commands."
I don't know what any of those abbreviations stand for.

I think this might be my solution:
"Direct Import and Export from/to a Tab Delimited File - Tab delimited files are not exactly Excel, but they are Excel compatible. So this is an easy way to extract info from Excel data directly into fields on an AcroForm PDF. It is not so good for exporting data to Excel. The big advantage is that it works on Macintosh as well as Windows. "

Do you know of an accessible explanation of this process? I am at work and cant be signing up for memberships all over. This one is enough :).

Thank you, by the way.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
That's the method that "mmazal" is using. However, it requires a good bit of scripting(which you can copy from the membership site). Are you a programmer? Are you familiar with the Acrobat JavaScript environment?

If you are not a programmer I would suggest that you use the "Forms > Manage Form Data > Import Data..." menu item.Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

scderacjor
Registered: Mar 27 2009
Posts: 123
I am an unofficial programmer. My first time using LiveCycle was a year and a half ago, and I have been using this site for almost all of my assignments since then. I am learning/teaching myself as I go.

I tried to use the "Forms > Manage Form Data > Import Data" but was only able to pull data from the first row of the Excell sheet. My users have to use this every month, for about 30-50 customers. They were using mail merge in MS Word. I didn't know this before creating the PDF version of their letter in LiveCycle. When I showed it to them, they said "We need mail merge!!" So now I am starting over.I need to be able to import data, but for 30 or so forms at once.
Does that explanation help?
scderacjor
Registered: Mar 27 2009
Posts: 123
How about this solution. I read it in another post you replied to. Do you know anything about how to execute this, or do you just know the process exists? I know a bit about LiveCycle now and I think this is the solution I'm looking for. Is it an add instance thing?

>"If you can exort the data in to an XML file you can design a Dynamic LiveCycle form that will repeat the page for each set of data in the XML. There is no scripting required for this solution, but you need to learn quite a bit about LiveCycle form design. "
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You have a few options here.

1. Write an automation script for prefoming a mail merge operation on the Regular Acrobat form using a tab delimited file exported from Excel
2. Write an automation script that uses ADBC to connect directly to the Excel file.
3. Create a LiveCycle form that connects to the Excel File
4. Create a Dynamic LiveCycle form that repeats a page for each entry set in an XML file.

To perform #4 you need to export the data from Excel into XML format. Then create a blank LiveCycle form and connect it to the XML file. Now drag the entire connection onto the form design. The subform that contains the fields will be your repeatable page. From here you'll need to expand it and fill it out with the form design. And make sure the form is setup properly for the kind of dynamic operation you want.

You need to watch these two eSeminars:
https://admin.adobe.acrobat.com/_a200985228/p69655795/
https://admin.adobe.acrobat.com/_a200985228/p87746471/


Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

melvin19842000
Registered: Jun 10 2010
Posts: 7
Hello Mmazal ,thomp and Others,

I am facing same problem as mentioned earlier:

"We have been supplied a PDF with form fields and a excel spreadsheet with data,
is it possible to import the data into the form fields of PDF and create Pdf file for each row"

Fortunately My excel column names and Pdf names are same.

How should i do it in "Adobe Acrobat professional 7.0"

Few Points:
1) if i click on FORMS,I cant see "Managed Form Data-->Import data
2)When i clcik on Form Data,I see "import data Disabled?

Is it due to 7.0?

Its very important ,can you suggest Solutions please?

melvinpereira

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
What you are asking about is a variable data process. And yes, it's possible. I've created variable data workflows using Excel data many times in the exactly the same way outlined by mmazal above. I've written extensivly about it here:
http://www.pdfscripting.com/public/department48.cfm

And you can also import data manually.

You're import options may be disabled because the form is Protected, or Enabled with Reader Rights. Check the document properties.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

melvin19842000
Registered: Jun 10 2010
Posts: 7
Thank you thomp for replying.What properties i should set/reset for adobe acrobat document to allow import/export data?

melvinpereira

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I don't know exactly because I don't know what's wrong with your document. That's why you need to look at the security tab on the documet properties dialog and see if there are any restrictions listed.

Try doing a Save As Copy. This might remove the problem settings.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

tguess
Registered: Aug 26 2010
Posts: 2
Does anyone possess a script similar to mmazal and would be willing to share it?
melvin19842000
Registered: Jun 10 2010
Posts: 7
Hey All...I wrote program to fill PDF fileds with Excel data. if any one need help send me e-mail with your exact requirement on:melvin19842000 [at] gmail [dot] comIf you want to write script in PDF then it becomes bit complicated matter so i did not try that approach.

melvinpereira

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Take a look at this web page:
http://www.pdfscripting.com/public/department48.cfm

And lookup the "doc.importTextData()" function in the Acrobat JavaScript Reference.


Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

tguess
Registered: Aug 26 2010
Posts: 2
Melvin,

To start off, I've never wrote in JavaScript; however, I'm up for the challenge. I do have intermediate skills at VBA coding.

My predicament is that I have 122 PDF form fields that need to be populated from existing data in an excel spreadsheet (Within the spreadsheet, there are about 500 rows of data that will in essence populate 500 separate forms).

I’ve setup a PDF form with corresponding form field titles and spreadsheet column headers. I have no problem copying out information to a text file and using Forms -> Manage Form Data -> Import Data from text file. However, with this much data, I would like to automate the process. Ultimately, I would like to achieve setting up a code to populate the correct fields with corresponding data from each row in the text document and then save the PDF form, then continuously loop through each row of the text document, repeat import data and saving the PDF form until all data within text file has been completed.If you can figure this out, you’ll be a life-saver, I not I appreciate you inquiring about my dilemma.

Thanks,
Tom
melvin19842000
Registered: Jun 10 2010
Posts: 7
Hey Tom,

No worries. I have written code in VB.NET which does Whatever you want.if i am not wrong you want to do following process:Read one row from Excel file .i assume it has 122 columns and put those values into 122 form field Pdf file and generate 1 PDF file

Repeat the above step 500 times for 500 rows in Excel file . So end result will be 500 PDF files.

Even if there is is variation, i can do that. send me your e-mail address at:melvin19842000 [at] gmail [dot] com and we can discuss....Even if there is more complicated process i can do that.

melvinpereira

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Implementing a variable data process in Acrobat can be accomplished in a few different ways. One method, as Melvin points out, is to use the IAC interface to Acrobat in a VB program. It contains a form handling API for filling in fields, and VB has a library for reading excel data. But it really is much simpler to use Acrobat JavaScript since it will fill in a form from a line in an Excel file with a single line of code. I've already written about the ins and outs of this process at www.pdfscripting.com.


Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script