Skip to main content
sureshy2015
Level 4
Jan 11, 2016 6:05 AM UTC
Solved

How to export audit logs of a page to excel sheet?

How to export audit logs of a page to excel sheet?

 

Is there any OOTB functionality ?.If not tell me how to achieve this.Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Oct 18, 2016 12:10 PM UTC

Hi Suresh

Your question is already answered here in this post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__xrmy-how_to_exportaudit.html

// How to export audit logs of a page to excel sheet?

o fully automate this process, i would advice you to create CSV/Exel file within OSGI sling service.

 

Lets say, you have a JSON like the following :

{"infile": [{"field1": 11,"field2": 12,"field3": 13},
            {"field1": 21,"field2": 22,"field3": 23},
            {"field1": 31,"field2": 32,"field3": 33}]}
Lets see the code for converting it to csv :

import org.apache.commons.io.FileUtils;

import org.json.CDL;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class JSON2CSV {
  public static void main(String myHelpers[]){
     String jsonString = "{\"infile\": [{\"field1\": 11,\"field2\": 12,\"field3\": 13},{\"field1\": 21,\"field2\": 22,\"field3\": 23},{\"field1\": 31,\"field2\": 32,\"field3\": 33}]}"

     JSONObject output = new JSONObject(jsonOut);
     JSONArray docs = response.getJSONArray("infile");

     File file=new File("yourpath/fromJSON.csv");
     String csv = CDL.toString(docs);
     FileUtils.writeStringToFile(file, csv);
  }
}
Now you got the CSV generated from JSON.

It should look like this:

field1,field2,field3
11,22,33
21,22,23
31,32,33
Reference Link:- http://stackoverflow.com/questions/7172158/converting-json-to-xls-csv-in-java

 

Option 2:- Use Jquery Plugin to convert Json to Excel.

Link:- http://w3lessons.info/2015/07/13/export-html-table-to-excel-csv-json-pdf-png-using-jquery/

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni

1 reply

kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Oct 18, 2016 12:10 PM UTC

Hi Suresh

Your question is already answered here in this post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__xrmy-how_to_exportaudit.html

// How to export audit logs of a page to excel sheet?

o fully automate this process, i would advice you to create CSV/Exel file within OSGI sling service.

 

Lets say, you have a JSON like the following :

{"infile": [{"field1": 11,"field2": 12,"field3": 13},
            {"field1": 21,"field2": 22,"field3": 23},
            {"field1": 31,"field2": 32,"field3": 33}]}
Lets see the code for converting it to csv :

import org.apache.commons.io.FileUtils;

import org.json.CDL;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class JSON2CSV {
  public static void main(String myHelpers[]){
     String jsonString = "{\"infile\": [{\"field1\": 11,\"field2\": 12,\"field3\": 13},{\"field1\": 21,\"field2\": 22,\"field3\": 23},{\"field1\": 31,\"field2\": 32,\"field3\": 33}]}"

     JSONObject output = new JSONObject(jsonOut);
     JSONArray docs = response.getJSONArray("infile");

     File file=new File("yourpath/fromJSON.csv");
     String csv = CDL.toString(docs);
     FileUtils.writeStringToFile(file, csv);
  }
}
Now you got the CSV generated from JSON.

It should look like this:

field1,field2,field3
11,22,33
21,22,23
31,32,33
Reference Link:- http://stackoverflow.com/questions/7172158/converting-json-to-xls-csv-in-java

 

Option 2:- Use Jquery Plugin to convert Json to Excel.

Link:- http://w3lessons.info/2015/07/13/export-html-table-to-excel-csv-json-pdf-png-using-jquery/

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Translate
Kautuk Sahni