Dataweave is not identifying headers in Excel fileMule Dataweave: using dynamic key while transforming json to xmlHow to use multiple database payloads for DataWeave inputsMule DataWeave JSON content is nullMerge two json payload with dataweaveDataweave XML-XML Transformation “Cannot coerce a :array to a :string.”Show input field names from Java Map while mapping to new JSON object in DataweaveStore variabe against each JSON object in a list using DataweaveCombine records into a single JSON object per Category using DataweaveMulesoft dataweave: How to convert xlsx file to JSON by including headers?Wildcard for Excel worksheet name in Dataweave
In a diamond problem in c++ , Why do we need to call grand_parent constructor from child class?
How do professional electronic musicians/sound engineers combat listening fatigue?
How were the LM astronauts supported during the moon landing and ascent? What were the max G's on them during these phases?
How can I stop myself from micromanaging other PCs' actions?
401(k) investment after being fired. Do I own it?
How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?
Iterate over non-const variables in C++
The seven story archetypes. Are they truly all of them?
Why is a dedicated QA team member necessary?
What does "see" in "the Holy See" mean?
Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?
How to judge a Ph.D. applicant that arrives "out of thin air"
What is the difference between 1/3, 1/2, and full casters?
Other than a swing wing, what types of variable geometry have flown?
Trapped in an ocean Temple in Minecraft?
Commercial jet accompanied by small plane near Seattle
Are there any examples of technologies have been lost over time?
A planet illuminated by a black hole?
How important is a good quality camera for good photography?
Why no ";" after "do" in sh loops?
Character is called by their first initial. How do I write it?
High income, sudden windfall
Why can't my huge trees be chopped down?
Extrapolation v. Interpolation
Dataweave is not identifying headers in Excel file
Mule Dataweave: using dynamic key while transforming json to xmlHow to use multiple database payloads for DataWeave inputsMule DataWeave JSON content is nullMerge two json payload with dataweaveDataweave XML-XML Transformation “Cannot coerce a :array to a :string.”Show input field names from Java Map while mapping to new JSON object in DataweaveStore variabe against each JSON object in a list using DataweaveCombine records into a single JSON object per Category using DataweaveMulesoft dataweave: How to convert xlsx file to JSON by including headers?Wildcard for Excel worksheet name in Dataweave
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am using Mule 4 and Anypoint Studio 7.
I want to extract data from an Excel spreadsheet but the table I want to extract data from starts at line 4 in the worksheet and the output from Transform message is null which I assume is because it doesn't detect the column names as they are at line 4 and not line 1.
How can I fix this?
Dataweave XML
<ee:transform doc:name="Transform Message" doc:id="1bdda7fe-2abe-48d3-8bc5-42a94c12b6b9" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
]]></ee:set-payload>
</ee:message>
</ee:transform>
Dataweave code:
%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
Excel

Thanks for any help
mule anypoint-studio dataweave
add a comment |
I am using Mule 4 and Anypoint Studio 7.
I want to extract data from an Excel spreadsheet but the table I want to extract data from starts at line 4 in the worksheet and the output from Transform message is null which I assume is because it doesn't detect the column names as they are at line 4 and not line 1.
How can I fix this?
Dataweave XML
<ee:transform doc:name="Transform Message" doc:id="1bdda7fe-2abe-48d3-8bc5-42a94c12b6b9" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
]]></ee:set-payload>
</ee:message>
</ee:transform>
Dataweave code:
%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
Excel

Thanks for any help
mule anypoint-studio dataweave
A thought: Can you use a separate transformer before to trim the first 3 lines? Your header would be the same, just changeheader=falseand the body should bepayload[3 to -1]. You could then feed the result of that into your script above.
– jerney
Mar 26 at 16:49
Updated answer.
– Ryan Carter
Apr 3 at 16:25
add a comment |
I am using Mule 4 and Anypoint Studio 7.
I want to extract data from an Excel spreadsheet but the table I want to extract data from starts at line 4 in the worksheet and the output from Transform message is null which I assume is because it doesn't detect the column names as they are at line 4 and not line 1.
How can I fix this?
Dataweave XML
<ee:transform doc:name="Transform Message" doc:id="1bdda7fe-2abe-48d3-8bc5-42a94c12b6b9" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
]]></ee:set-payload>
</ee:message>
</ee:transform>
Dataweave code:
%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
Excel

Thanks for any help
mule anypoint-studio dataweave
I am using Mule 4 and Anypoint Studio 7.
I want to extract data from an Excel spreadsheet but the table I want to extract data from starts at line 4 in the worksheet and the output from Transform message is null which I assume is because it doesn't detect the column names as they are at line 4 and not line 1.
How can I fix this?
Dataweave XML
<ee:transform doc:name="Transform Message" doc:id="1bdda7fe-2abe-48d3-8bc5-42a94c12b6b9" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
]]></ee:set-payload>
</ee:message>
</ee:transform>
Dataweave code:
%dw 2.0
input payload application/xlsx header=true
output application/json
---
"Customers": payload."CUSTOMERS" filter $$ > 2 map ( cUSTOMER , indexOfCUSTOMER ) ->
"Type": cUSTOMER.type,
"Category": cUSTOMER.category
Excel

Thanks for any help
mule anypoint-studio dataweave
mule anypoint-studio dataweave
edited Apr 3 at 12:53
user3165854
asked Mar 26 at 16:33
user3165854user3165854
37813 silver badges50 bronze badges
37813 silver badges50 bronze badges
A thought: Can you use a separate transformer before to trim the first 3 lines? Your header would be the same, just changeheader=falseand the body should bepayload[3 to -1]. You could then feed the result of that into your script above.
– jerney
Mar 26 at 16:49
Updated answer.
– Ryan Carter
Apr 3 at 16:25
add a comment |
A thought: Can you use a separate transformer before to trim the first 3 lines? Your header would be the same, just changeheader=falseand the body should bepayload[3 to -1]. You could then feed the result of that into your script above.
– jerney
Mar 26 at 16:49
Updated answer.
– Ryan Carter
Apr 3 at 16:25
A thought: Can you use a separate transformer before to trim the first 3 lines? Your header would be the same, just change
header=false and the body should be payload[3 to -1]. You could then feed the result of that into your script above.– jerney
Mar 26 at 16:49
A thought: Can you use a separate transformer before to trim the first 3 lines? Your header would be the same, just change
header=false and the body should be payload[3 to -1]. You could then feed the result of that into your script above.– jerney
Mar 26 at 16:49
Updated answer.
– Ryan Carter
Apr 3 at 16:25
Updated answer.
– Ryan Carter
Apr 3 at 16:25
add a comment |
1 Answer
1
active
oldest
votes
You can set the property tableOffset to the column where the data starts for xlsx format.
For Mule 3:
In GUI:
- Right click on the "Payload" label (left panel).
- Click on the "Reader Configuration" option.
- GUI opens with multiple options to be set.
- Configure the "tableOffset" to the starting cell of the table. in your example A4.
Code example:
<dw:transform-message doc:name="Transform Message" metadata:id="9abf7128-71b8-4610-8fca-7ceda17f852e">
<dw:input-payload mimeType="application/xlsx">
<dw:reader-property name="tableOffset" value="A4"/>
</dw:input-payload>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
</dw:transform-message>
For Mule 4, you need to set the reader properties on the event source:
https://docs.mulesoft.com/mule-runtime/4.1/dataweave-formats#reader_writer_properties
For example, if you are reading the xlsx from a file:
<file:listener doc:name="On New File" config-ref="File_Config" outputMimeType='application/xlsx tableOffset="A4"'>
<scheduling-strategy >
<fixed-frequency frequency="45" timeUnit="SECONDS"/>
</scheduling-strategy>
<file:matcher filenamePattern="myfile.xlsx" />
</file:listener>
Before your transform you could also try using a simple transform to add the new reader properties:
<set-payload value="#[output application/xlsx tableOffset='A4' --- payload]" />
<!-- Then your normal transformer -->
<ee:transform xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"
doc:id="bed303c7-1549-45da-af58-10c4ad937926">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json --- payload]]></ee:set-payload>
</ee:message>
</ee:transform>
Hi. That option doesn't seem to be available in Mule 4/ Dataweave 2.0. I have tried adding the code too but it doesn't seem to work either. Any other suggestions? I've updated my question to include the XML of the transform message.
– user3165854
Apr 3 at 12:52
Added some mule 4 options.
– Ryan Carter
Apr 3 at 16:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362057%2fdataweave-is-not-identifying-headers-in-excel-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can set the property tableOffset to the column where the data starts for xlsx format.
For Mule 3:
In GUI:
- Right click on the "Payload" label (left panel).
- Click on the "Reader Configuration" option.
- GUI opens with multiple options to be set.
- Configure the "tableOffset" to the starting cell of the table. in your example A4.
Code example:
<dw:transform-message doc:name="Transform Message" metadata:id="9abf7128-71b8-4610-8fca-7ceda17f852e">
<dw:input-payload mimeType="application/xlsx">
<dw:reader-property name="tableOffset" value="A4"/>
</dw:input-payload>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
</dw:transform-message>
For Mule 4, you need to set the reader properties on the event source:
https://docs.mulesoft.com/mule-runtime/4.1/dataweave-formats#reader_writer_properties
For example, if you are reading the xlsx from a file:
<file:listener doc:name="On New File" config-ref="File_Config" outputMimeType='application/xlsx tableOffset="A4"'>
<scheduling-strategy >
<fixed-frequency frequency="45" timeUnit="SECONDS"/>
</scheduling-strategy>
<file:matcher filenamePattern="myfile.xlsx" />
</file:listener>
Before your transform you could also try using a simple transform to add the new reader properties:
<set-payload value="#[output application/xlsx tableOffset='A4' --- payload]" />
<!-- Then your normal transformer -->
<ee:transform xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"
doc:id="bed303c7-1549-45da-af58-10c4ad937926">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json --- payload]]></ee:set-payload>
</ee:message>
</ee:transform>
Hi. That option doesn't seem to be available in Mule 4/ Dataweave 2.0. I have tried adding the code too but it doesn't seem to work either. Any other suggestions? I've updated my question to include the XML of the transform message.
– user3165854
Apr 3 at 12:52
Added some mule 4 options.
– Ryan Carter
Apr 3 at 16:25
add a comment |
You can set the property tableOffset to the column where the data starts for xlsx format.
For Mule 3:
In GUI:
- Right click on the "Payload" label (left panel).
- Click on the "Reader Configuration" option.
- GUI opens with multiple options to be set.
- Configure the "tableOffset" to the starting cell of the table. in your example A4.
Code example:
<dw:transform-message doc:name="Transform Message" metadata:id="9abf7128-71b8-4610-8fca-7ceda17f852e">
<dw:input-payload mimeType="application/xlsx">
<dw:reader-property name="tableOffset" value="A4"/>
</dw:input-payload>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
</dw:transform-message>
For Mule 4, you need to set the reader properties on the event source:
https://docs.mulesoft.com/mule-runtime/4.1/dataweave-formats#reader_writer_properties
For example, if you are reading the xlsx from a file:
<file:listener doc:name="On New File" config-ref="File_Config" outputMimeType='application/xlsx tableOffset="A4"'>
<scheduling-strategy >
<fixed-frequency frequency="45" timeUnit="SECONDS"/>
</scheduling-strategy>
<file:matcher filenamePattern="myfile.xlsx" />
</file:listener>
Before your transform you could also try using a simple transform to add the new reader properties:
<set-payload value="#[output application/xlsx tableOffset='A4' --- payload]" />
<!-- Then your normal transformer -->
<ee:transform xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"
doc:id="bed303c7-1549-45da-af58-10c4ad937926">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json --- payload]]></ee:set-payload>
</ee:message>
</ee:transform>
Hi. That option doesn't seem to be available in Mule 4/ Dataweave 2.0. I have tried adding the code too but it doesn't seem to work either. Any other suggestions? I've updated my question to include the XML of the transform message.
– user3165854
Apr 3 at 12:52
Added some mule 4 options.
– Ryan Carter
Apr 3 at 16:25
add a comment |
You can set the property tableOffset to the column where the data starts for xlsx format.
For Mule 3:
In GUI:
- Right click on the "Payload" label (left panel).
- Click on the "Reader Configuration" option.
- GUI opens with multiple options to be set.
- Configure the "tableOffset" to the starting cell of the table. in your example A4.
Code example:
<dw:transform-message doc:name="Transform Message" metadata:id="9abf7128-71b8-4610-8fca-7ceda17f852e">
<dw:input-payload mimeType="application/xlsx">
<dw:reader-property name="tableOffset" value="A4"/>
</dw:input-payload>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
</dw:transform-message>
For Mule 4, you need to set the reader properties on the event source:
https://docs.mulesoft.com/mule-runtime/4.1/dataweave-formats#reader_writer_properties
For example, if you are reading the xlsx from a file:
<file:listener doc:name="On New File" config-ref="File_Config" outputMimeType='application/xlsx tableOffset="A4"'>
<scheduling-strategy >
<fixed-frequency frequency="45" timeUnit="SECONDS"/>
</scheduling-strategy>
<file:matcher filenamePattern="myfile.xlsx" />
</file:listener>
Before your transform you could also try using a simple transform to add the new reader properties:
<set-payload value="#[output application/xlsx tableOffset='A4' --- payload]" />
<!-- Then your normal transformer -->
<ee:transform xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"
doc:id="bed303c7-1549-45da-af58-10c4ad937926">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json --- payload]]></ee:set-payload>
</ee:message>
</ee:transform>
You can set the property tableOffset to the column where the data starts for xlsx format.
For Mule 3:
In GUI:
- Right click on the "Payload" label (left panel).
- Click on the "Reader Configuration" option.
- GUI opens with multiple options to be set.
- Configure the "tableOffset" to the starting cell of the table. in your example A4.
Code example:
<dw:transform-message doc:name="Transform Message" metadata:id="9abf7128-71b8-4610-8fca-7ceda17f852e">
<dw:input-payload mimeType="application/xlsx">
<dw:reader-property name="tableOffset" value="A4"/>
</dw:input-payload>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
</dw:transform-message>
For Mule 4, you need to set the reader properties on the event source:
https://docs.mulesoft.com/mule-runtime/4.1/dataweave-formats#reader_writer_properties
For example, if you are reading the xlsx from a file:
<file:listener doc:name="On New File" config-ref="File_Config" outputMimeType='application/xlsx tableOffset="A4"'>
<scheduling-strategy >
<fixed-frequency frequency="45" timeUnit="SECONDS"/>
</scheduling-strategy>
<file:matcher filenamePattern="myfile.xlsx" />
</file:listener>
Before your transform you could also try using a simple transform to add the new reader properties:
<set-payload value="#[output application/xlsx tableOffset='A4' --- payload]" />
<!-- Then your normal transformer -->
<ee:transform xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"
doc:id="bed303c7-1549-45da-af58-10c4ad937926">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json --- payload]]></ee:set-payload>
</ee:message>
</ee:transform>
edited Apr 3 at 16:24
answered Mar 27 at 11:52
Ryan CarterRyan Carter
10.4k2 gold badges15 silver badges23 bronze badges
10.4k2 gold badges15 silver badges23 bronze badges
Hi. That option doesn't seem to be available in Mule 4/ Dataweave 2.0. I have tried adding the code too but it doesn't seem to work either. Any other suggestions? I've updated my question to include the XML of the transform message.
– user3165854
Apr 3 at 12:52
Added some mule 4 options.
– Ryan Carter
Apr 3 at 16:25
add a comment |
Hi. That option doesn't seem to be available in Mule 4/ Dataweave 2.0. I have tried adding the code too but it doesn't seem to work either. Any other suggestions? I've updated my question to include the XML of the transform message.
– user3165854
Apr 3 at 12:52
Added some mule 4 options.
– Ryan Carter
Apr 3 at 16:25
Hi. That option doesn't seem to be available in Mule 4/ Dataweave 2.0. I have tried adding the code too but it doesn't seem to work either. Any other suggestions? I've updated my question to include the XML of the transform message.
– user3165854
Apr 3 at 12:52
Hi. That option doesn't seem to be available in Mule 4/ Dataweave 2.0. I have tried adding the code too but it doesn't seem to work either. Any other suggestions? I've updated my question to include the XML of the transform message.
– user3165854
Apr 3 at 12:52
Added some mule 4 options.
– Ryan Carter
Apr 3 at 16:25
Added some mule 4 options.
– Ryan Carter
Apr 3 at 16:25
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362057%2fdataweave-is-not-identifying-headers-in-excel-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
A thought: Can you use a separate transformer before to trim the first 3 lines? Your header would be the same, just change
header=falseand the body should bepayload[3 to -1]. You could then feed the result of that into your script above.– jerney
Mar 26 at 16:49
Updated answer.
– Ryan Carter
Apr 3 at 16:25