Exporting to CSV, field names and field values in separate columns
Hi!
Sorry for this noob-question, but that is what I am.
Regarding Acrobat Pro DC and field data export.
I want to export field data to a CSV, with the field names in one vertical column and the field values in the next vertical column. Like this:
Column A | Column B
Name 1 | Value 1
Name 2 | Value 2
I've been playing with the code below, switching places with ; and /n and /r but nothing gives the output I want.
I can get all data in one vertical column or, with the code below, names and values in two separate vertical rows.
Any tips?
var fieldValues = [];
var fieldValuesNames = [];
for (var i = 0; i < this.numFields; i++)
{
fieldValues.push(this.getField(this.getNthFieldName(i)).value);
var f = this.getField(this.getNthFieldName(i));
fieldValuesNames.push(f.name);
}
this.createDataObject("output.csv",fieldValuesNames.join(";") + "\r\n" + fieldValues.join(";"));
this.exportDataObject({ cName:"output.csv", nLaunch: "2"});
