gpt4 book ai didi

javascript - XLSX 文件中查询定义的位置

转载 作者:搜寻专家 更新时间:2023-11-01 04:35:03 24 4
gpt4 key购买 nike

使用以下自定义查询创建 xlsx 文件后(从 typicode.comjsonplaceholder 服务加载数据)

let
Source = Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/posts")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"userId", "id", "title", "body"}, {"userId", "id", "title", "body"})
in
#"Expanded Column1"

并解压缩它 我希望可以在生成的文件夹结构中以某种形式找到上面的字符串(查询定义)。目标是以编程方式替换 URL,但不知何故,我能找到的唯一查询定义是

<connection id="1" keepAlive="1" name="Query - posts" description="Connection to the 'posts' query in the workbook." type="5" refreshedVersion="6" background="1" saveData="1">
<dbPr connection="Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=posts;Extended Properties=&quot;&quot;" command="SELECT * FROM [posts]"/>
</connection>

虽然我不建议任何人从陌生人那里下载和运行 office 文件,但我确实将 xlsx 上传到 nofile.io .

我希望 queryTable 上有一些 formula 属性,但查询表定义看起来像

<queryTable xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" name="ExternalData_1" connectionId="1" autoFormatId="16" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="0">
<queryTableRefresh nextId="5">
<queryTableFields count="4">
<queryTableField id="1" name="userId" tableColumnId="5" />
<queryTableField id="2" name="id" tableColumnId="2" />
<queryTableField id="3" name="title" tableColumnId="3" />
<queryTableField id="4" name="body" tableColumnId="4" />
</queryTableFields>
</queryTableRefresh>
</queryTable>

理想情况下,我只想要有关规范如何存储此信息的信息(因为我想在浏览器的前端手动编辑此信息),尽管任何允许我生成此信息的解决方案都是完美的。

最佳答案

虽然这是一篇旧帖子,但我添加了对开放规范的引用,该规范详细说明了如何在 Excel (.xlsx) Office Open XML 文件格式中找到查询信息。如前所述,customXml\item[x].xml 部分将包含 DataMashup 格式信息。这些封装和零件数据的规范可以在以下两个链接中找到:

[MS-QDEFF]: Query Definition File Format

[MS-QDEIF]: Query Definition Interoperability Format

需要注意的是顶级二进制流(在 base64 解码来自 DataMashup 元素的值之后)在开头有一个 4 字节的版本字段(为 0),在每个包之前有一个 4 字节的大小字段、权限和元数据部分。一旦每个片段被提取出来,它就可以作为一个独立的 PK Zip 包(实际上是一个 OPC - Open Packaging Convention)。

关于javascript - XLSX 文件中查询定义的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47412850/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com