Read CSV file data stored in DAM | Community
Skip to main content
Himanshu_Singhal
Community Advisor
Community Advisor
May 2, 2017
Solved

Read CSV file data stored in DAM

  • May 2, 2017
  • 2 replies
  • 6262 views

Hi,

I've CSV file stored in DAM and I need to read data programmatically.

How can I do that?

Thanks,

Himanshu

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by cquser1

Hi,

I could think of the below :

Have a service user to read the file, which will be probably be placed at a specific DAM location. Sharing few snippets, which might help you.

Node assetNode = session.getNode(damPath);

Use ResourceResolver, adapt it to an Asset and further do the below :

BufferedReader br = new BufferedReader(new InputStreamReader(asset.getRendition(Constants.ORIGINAL).getStream()));

For further processing, the below link might help

https://www.mkyong.com/java/how-to-read-and-parse-csv-file-in-java/ 

2 replies

cquser1
cquser1Accepted solution
May 3, 2017

Hi,

I could think of the below :

Have a service user to read the file, which will be probably be placed at a specific DAM location. Sharing few snippets, which might help you.

Node assetNode = session.getNode(damPath);

Use ResourceResolver, adapt it to an Asset and further do the below :

BufferedReader br = new BufferedReader(new InputStreamReader(asset.getRendition(Constants.ORIGINAL).getStream()));

For further processing, the below link might help

https://www.mkyong.com/java/how-to-read-and-parse-csv-file-in-java/ 

smacdonald2008
May 3, 2017

cquser is correct - you need to write a custom service using Java and create an OSGi bundle