mulesoft:从服务器获取excel文件时,如何应用{header:false}选项

发布于 2025-01-19 10:27:11 字数 443 浏览 3 评论 0原文

在DataWeave中使用RealUrl()函数时,我可以使用{“ header”:false}选项,如下所示,将列作为键和单元格作为JSON对象中的值:

var myInput = readUrl("classpath://examples/Test.xlsx", "application/xlsx", {"header":false})

JSON

{
        A: "A1",
        B: "B1",
        C: "",
        D: "",
        E: "E1"
}

我使用REST API致电Salesforce检索Excel文件。有没有一种方法可以应用{“ header”的类似选项:false}能够以与上面的JSON相似的方式提供Excel文件的内容?

In DataWeave when using the readUrl() function, I can utilize the {"header":false} option as shown below to give the column as the key and cell as the value in a JSON object:

var myInput = readUrl("classpath://examples/Test.xlsx", "application/xlsx", {"header":false})

JSON

{
        A: "A1",
        B: "B1",
        C: "",
        D: "",
        E: "E1"
}

I'm using a REST API call to Salesforce to retrieve an Excel file. Is there a way to apply a similar option of {"header":false} to be able to provide the content of the Excel file in similar way as JSON above?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忆依然 2025-01-26 10:27:11

使用此Mule Docs参考来查看受支持的读取属性。

https://docs.mulesoft.com/datawawaweave/2.4/datawaweave-formats-2.4/dataweave-formats- excel

您可以使用转换消息并使用如下所示的相同值

   %dw 2.0
input payload application/xlsx header=false
output application/json
---

Use this mule docs references to see supported read properties.

https://docs.mulesoft.com/dataweave/2.4/dataweave-formats-excel

You can use a transform message and use the same value as shown below

   %dw 2.0
input payload application/xlsx header=false
output application/json
---
要走干脆点 2025-01-26 10:27:11

您应该在使用 outputMimeType 属性创建负载的操作或源中设置正确的数据格式和属性。 文档对此进行了解释。在这种情况下,操作是

例子:

<http:request ... outputMimeType="application/csv; header=false">

You should set the correct data format and properties in the operation or source where the payload is created with the outputMimeType attribute. This is explained in the documentation. In this case the operation is the <http:request>.

Example:

<http:request ... outputMimeType="application/csv; header=false">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文