Generate Excel file From Tjava component

Four Stars

Generate Excel file From Tjava component

Want to generate excel file from tjava componnet contains Arraylist of headers , List of hashmap for data of excel file 

 

tjava component is as follows :

 

List<String> headers = new ArrayList<String>();
headers.add("header1");
headers.add("header2");
headers.add("header3");

List<HashMap<String, String>> rows = new ArrayList<HashMap<String,String>>();

HashMap<String, String> row1 = new HashMap<String, String>();
row1.put("Header1","abc");
row1.put("header2","10");
row1.put("header3", "xyz");

rows.add(row1);

HashMap<String, String> row2 = new HashMap<String, String>();
row1.put("Header1","abcABC");
row1.put("header2","1010");
row1.put("header3", "xyzXYZ");

rows.add(row2);
this.globalMap.put("headres", headers);
this.globalMap.put("rows", rows);

 

need to create excel file as follows

 

Header1  Header2 Header3

abc             10          xyz

abcABC       1010   xyzXYZ

Community Manager

Re: Generate Excel file From Tjava component

Use a tJavaFlex for this. Prepare your data in the Start Code section. Open a loop in the Start Code (for or while). Then you can send your row data to your XML component in the Main Code section. The Main Code section is called once for every loop iteration. You can use that to go through your ArrayList and pass the values to your output row. In your End Code section, simply close the loop and carry out any tidy up code.

 

 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog