Skip to main content
Oct 16, 2020 3:55 PM UTC
Answered

Import Data from excel into non-fillable pdf

I am looking for a way to

1. Check if any word on PDF page matches a word in an excel spreadsheet.

2. Copy a corresponding cell's data and place it on the PDF. (not in a form).

 

I'll attach a sample pdf page.

I would like to see if the word Sample appears in the excel sheet and

pull out the corresponding data (Test) and paste it inside. 

Thanks in advance

try67
try67Correct answer
Community Expert
Oct 16, 2020 5:29 PM UTC

You can't do it with an Excel file directly. You will have to first convert it to a plain-text file, like a CSV or a tab-delimited file. Then you'll be able to read its contents using a script, search for matches and then copy that "cell" into the file, for example using a comment. This is not a trivial scripting task, though.

4 replies

Oct 18, 2020 6:25 PM UTC

Just wondering, I have much more experience with vba I'm excel. Would it be easier (if possible) to do this sorry of thing through vba?

 

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Oct 16, 2020 5:29 PM UTC

You can't do it with an Excel file directly. You will have to first convert it to a plain-text file, like a CSV or a tab-delimited file. Then you'll be able to read its contents using a script, search for matches and then copy that "cell" into the file, for example using a comment. This is not a trivial scripting task, though.

Translate
Oct 16, 2020 5:35 PM UTC

Thanks Right I know about the cab part. I assumed that it wouldn't be a simple scripting task but any direction would be a great help. I'm dealing with thousands of pdf pages. Where would I go to find how to do this?

Translate
try67
Community Expert
Community Expert
Oct 16, 2020 5:43 PM UTC

Reading the file can be done using the readFileIntoStream method of the util object. Searching it is just a simple string manipulation. Inserting the result can be done using the addAnnot method to create a comment.

Translate