Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Read CSV file data stored in DAM

Himanshu_Singhal
Community Advisor
Community Advisor

Hi,

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

How can I do that?

Thanks,

Himanshu

1 Accepted Solution
cquser1
Correct answer by
Level 8
Level 8

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/ 

View solution in original post

2 Replies
cquser1
Correct answer by
Level 8
Level 8

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/ 

View solution in original post

smacdonald2008
Level 10
Level 10

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