Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
11

Import excel table into PDF

Community Beginner ,
Jun 14, 2023 Jun 14, 2023

I am looking for support with importing data from an Excel (table) column to live update a PDF. 
We generate lists every quarter and the winners needed to be updated by grouping. We currently copy and paste over 100 times to complete the task. I am looking for a method to automate.
Thank you! 

 

 

TOPICS
Comment review and collaborate Experiment , Create PDFs , Edit and convert PDFs , General troubleshooting , How to , PDF
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2023 Jun 14, 2023

Hi,

Did you try "Import Data..." of the "Prepare Form" tool?

You need to save the Excel sheet in .txt file format and the title of each column need to have the same name as the corresponding field.

Capture d’écran 2023-06-14 à 20.55.18.pngCapture d’écran 2023-06-14 à 20.53.22.png

Else, that can be done via a script.

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 14, 2023 Jun 14, 2023

I do not see an import function at the moment on my existing PDF. Is there a method to 'add' this function? 

Also, if you do have a smaple scritp I would love to review it. 

Thanks for the support. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 14, 2023 Jun 14, 2023

I am using Adobe Acrobat PRO with the ability to combine, edit etc. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2023 Jun 14, 2023

You should get the "Prepare Form" tool!

And about the script, it is depending on your need. So I need more information about the Excel sheet and your form.

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 14, 2023 Jun 14, 2023

The best way to describe it is that I have 60 cities across cananda, with winners in every city. I dont know how many winners there will be in each city until the end of the quarter.
For example: Toronto could have 15 winners this month and 7 the next. 

I get an excel list with all winners across all cities and then I need to separate them by city (I can do the excel work) and generate a PDF for only 1 city and deliver that to the manager of that city in PDF. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2023 Jun 14, 2023

Is it possible to share an entire Excel sheet with fictive data!

The script is able to generate automatically the form for each city without separating in Excel.

If you could share the form too... You can modify the background of the page with a blank page and only keep the fields.

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2023 Jun 15, 2023

Hi,

No answer!

Let's say the Excel sheet is saved in txt format (Unicode UTF-8) as an attachment in the form, such as my example.

You can run this script from an action wizard or the console window:

var pj=this.getDataObject(this.dataObjects[0].name);
var fichier=this.getDataObjectContents(pj.name);
var donnees=util.stringFromStream(fichier,"utf-8"); // Unicode UTF-8 File Format
var lignes=donnees.split("\r\n");	
cellules=new Array();
for (var i=0; i<lignes.length; i++) cellules[i]=lignes[i].split("\t");
cellules.shift();
cellules.sort(function(a, b){return a[0].localeCompare(b[0])});
theWinners=new Array();
for (var i=0; i<cellules.length; i++) {
	if (i==0) theWinners.push([cellules[0][0],[cellules[0][1]]]);
	else if (cellules[i][0]==theWinners[theWinners.length-1][0]) theWinners[theWinners.length-1][1].push(cellules[i][1]);
	else theWinners.push([cellules[i][0],[cellules[i][1]]]);
}
for (var i=0; i<theWinners.length; i++) {
	this.getField("city").value=theWinners[i][0];
	this.getField("winners").value=theWinners[i][1].toString().replace(/,/g,"\r");
	this.saveAs({
		cPath: this.path.replace(/.pdf$/i," \("+theWinners[i][0]+").pdf"),
		bCopy: true
	});
}
this.resetForm();
this.dirty=false;

The script will generate all forms following the city and including all winners!

Does that suit you?

@+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2023 Jun 14, 2023

Much simpler, I suspect, to use Office automation to take the live data and combine it with a Word template. This can be converted to PDF as required. Most things are harder to do once you already have a PDF.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 22, 2023 Jun 22, 2023
LATEST

Taking the advice from the replies, you're right.... It his harder to add live text to an already existing PDF. What I've done, is recreated the PDF template, formatting and all, in excel and the use the 'Save as PDF' option for all citites.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines