コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

how to find excel column number from the column name in AEM

Avatar

Level 2

Hi Team.

 

In our project, we are using an excel sheet which will be converted into Json. we are using a config file to map column like first column will be mapped to 0 and second column mapped to 1 and so on. 

 

Our logic is mapping using column numbers which is causing problem when in between any column is deleted.

 

Is there any way to get column number using column name. ??

 

In the below code, we are sending property key which will hold column no but I would like send property key containing column and get column number.

/**
* Gets the int val from props.
*
* @Param propertyKey
* the property key
* @Return the int val from props
*/
public static int getIntValFromProps(String propertyKey) {
int colNum = -1;
// final String colNumStr = PropertiesHelper.fetchPropertyFromCache(propertyKey);
final String colNumStr = PropertiesHelper.fetchPropertyFromCache(propertyKey);

if (colNumStr != null && !"".equals(colNumStr.trim())) {
colNum = Integer.parseInt(colNumStr.trim());
}
return colNum;
}

1 受け入れられたソリューション

Avatar

正解者
Community Advisor

@prash0905  how are you generating JSON from xlsx, may I know the API name?

if your ask is to get column name in transformed JSON from xlsx, Using   https://poi.apache.org/apidocs/5.0/ API you should be able to get required results in generated JSON. 

元の投稿で解決策を見る

1 返信

Avatar

正解者
Community Advisor

@prash0905  how are you generating JSON from xlsx, may I know the API name?

if your ask is to get column name in transformed JSON from xlsx, Using   https://poi.apache.org/apidocs/5.0/ API you should be able to get required results in generated JSON.