Skip to main content
Cbuerm
Participating Frequently
September 24, 2018
Answered

Export filled in fields to txt or excel in non-alphabetical order

  • September 24, 2018
  • 1 reply
  • 3539 views

Hello,

I'm new to Acrobat and I was hoping someone could shed some light on something I'm trying to do.

We have a form that we created that has a bunch of text fields, checkboxes, signatures etc... The end goal is to have the data that is entered into all of these fields be outputted and appended to a master excel spreadsheet.

What I am trying to do with this form right now is to figure out how to export only the field data. I see under Prepare Form>More (on the right panel)>Export Data that I am able to export it as a .txt file, but this is outputting it in alphabetical order and not in the order on the page.

If I export to an excel sheet it is just copying the entire page and converting it, when I only need the field data.

Is there another way to do this that I cannot find searching the internet? I have created a button that executed the following script, but it will be really inconvienent to have someone click the button, output the data, then import it manually in a sheet.

var fields = [ "ORIGINATOR", "DATE", "CUSTOMER"]; 

this.exportAsText( { aFields: fields }); 

Thanks for the help!

This topic has been closed for replies.
Correct answer try67

After much time I have an update for this question.

I have written a loop in which it copies all of the field data without titles into an array. I can get this to export as a text file by using this.createDataObject and this.exportDataObject successfully.

The only question I have left is with naming the outputted .txt file. Since this form will be reused many times, I would like the outputted text file to be named based on the filled in field values so each txt file has a unique name based on the form. I've tried modifying the exportDataObject a number of different ways but I cant quite figure out how Acrobat handles strings for naming the file.

Here is the code:

var fields = [ "ORIGINATOR", "DATE", "CUSTOMER", "TOOL #", "WORK ORDER #"];

var endarray = [];

for(i=0 ; i <= fields.length -1 ; i++){

    console.println(fields);

    arrayvalue = this.getField(fields).value.toString();

    endarray = arrayvalue;

  

    console.println(arrayvalue);

    console.println("i-value: " + i);

}

console.println(endarray);

var namestring = endarray[3] + " " + endarray[2] + " " + endarray[1];

console.println(namestring);

this.createDataObject({cName: "Exported Data.txt", cValue: endarray});

this.exportDataObject({cName: "Exported Data.txt", nLaunch: 1}); //Believe the issues is here with "Exported Data.txt"

I would like the produced .txt file to be named after the namestring variable instead of "Exported Data.txt"

Additionally, is there a way to export is as tab delimited instead of comma delimited?

Thank you.


Then simply replace "Exported Data.txt" with namestring + ".txt" ...

1 reply

try67
Community Expert
Community Expert
September 24, 2018

You can import that text file directly in Excel, just by dropping it in the

application window.

Cbuerm
CbuermAuthor
Participating Frequently
September 24, 2018

Is there a way to produce said txt file from the pdf  in page-order instead of alphabetical order? The main issue is not being able to produce the file that needs to be imported into excel at the end.

try67
Community Expert
Community Expert
September 24, 2018

You can specify any order you'd like in the array of fields.