跳到主要内容

从工作表中提取工作表 Excel 使用 Zapier

PDF4me 从工作表中提取工作表 Excel 是一个 Zapier 从某个位置导出一个或多个工作表的操作 Excel 工作簿结构 JSON按工作表名称筛选。可按名称、索引选择工作表,或两者都留空以提取所有工作表。返回一个 Base64 编码的 JSON 文档,可用于下一个 Zap 步骤。

此操作的作用

需要 Excel 从之前的 Zap 步骤中读取工作簿,读取您指定的(或全部)工作表,并将每个工作表转换为 JSON 以第一行作为标题行。结果是一个以工作表名称为键的字典,因此,包含“汇总”和“销售”工作表的工作簿将返回一个字典。 JSON 同时包含两个键的对象。可用于将多页报表导入到其他系统中。 API数据库或下游自动化步骤需要结构化数据而不是电子表格文件。

相关博客文章
目前尚无关于此功能的博客文章——敬请期待。
在此期间,您可以浏览 PDF4me 博客,查看适用于各平台的教程和工作流程。
访问博客

验证您的身份 API 要求

要访问 PDF4me 网站 API 通过 Zapier每个请求都必须包含正确的身份验证凭据。身份验证可确保通信安全,并验证您作为授权用户的身份,从而实现与您的系统之间的无缝集成。 Zapier 工作流程和 PDF4meExcel 工作表提取服务。

您不容错过的重要事实

仅需提交文件。
文件名、工作表名称和工作表索引在文件中都是可选的。 Zapier 配置。将工作表字段留空以提取所有内容。
名称和索引会合并,它们之间不会相互过滤。
如果同时设置了工作表名称和工作表索引, PDF4me 提取联合体,即满足任一条件的所有工作表,而不仅仅是满足两个条件的工作表。
输出结果是一个以工作表名称为键的字典。
每个提取出来的工作表都成为解码过程中的一个独立密钥。 JSON这样,多页工作簿就能在一个响应中保持有序,而不是分散在多个文件中。

:::提示:从之前的步骤中获取映射文件和文件名

使用 + 旁边的按钮 文件文件名 例如,从之前的 Zap 步骤进行映射, 完整文件名 来自前 PDF4me Excel 行动。 Excel 文件必须提供完整内容,不能仅提供“存在但未显示”的引用。

:::

:::警告 文件:(存在但未显示)

如果在“文件”字段中看到“文件:(存在但未显示)”并收到“文件为空”错误,请选择提供相应选项的选项。 完整文件内容 相反。参见 Zapier & Power Automate 尖端 详情请见下文。

:::

PDF4me Excel 工作表提取 Zapier 配置 - 文件、文件名、工作表名称、工作表索引
配置 Excel 提取工作表操作:只有文件字段带有星号,文件名和两个工作表目标字段都是可选的。

提取工作表的主要特点是什么?

  • 完整工作表提取JSON 自动报头检测
  • 灵活选择:按工作表名称、工作表索引或两者(并集)提取
  • 多页支持 一次操作提取多个工作表
  • 字典输出 按工作表名称筛选,方便访问
  • 基于 1 的索引 工作表索引

参数

“提取工作表”操作的完整参数列表。参数名称与以下内容匹配: Zapier 配置 UI 如上图所示。

快速设置清单
  1. 地图 文件 (Excel)来自您的触发器或上一步
  2. (可选)映射 文件名 (例如,上一步中的完整文件名)
  3. 进入 工作表名称 和/或 工作表索引或者将两者都留空以提取所有工作表
范围必需的它的作用例子
FileRequiredExcel file to extract worksheets from. Map from a previous step. Must provide full file content.[2. File from Step 2]
File NameConditionalExcel filename, used for output file identification.add_header_sample_file.xlsx
Worksheet NamesConditionalComma-separated worksheet names to extract. Combines (union) with Worksheet Indexes if both are set. Empty with Indexes = all worksheets.Sheet1, Sheet2
Worksheet IndexesConditionalComma-separated 1-based worksheet positions to extract. 1 = first worksheet. Combines with Worksheet Names.1,3
提取工作簿中的所有工作表

两者都保留 工作表名称工作表索引 空提取 所有工作表 在工作簿中输入到输出字典中。

重要的: 仅有的 文件 是必需的。请使用 + 每个字段旁边都有一个按钮,用于映射先前步骤中的数据。工作表索引从 1 开始(1 = 第一个工作表)。

提取工作表会返回什么?

PDF4me 从工作表中提取工作表 Excel 操作会将工作表数据以 Base64 编码的形式返回。 JSON 这是一个文档,不是可下载的文件,可以直接在 Zap 逻辑中使用。

场地类型它包含什么
documentBase64JSON byte array. Decodes to a dictionary keyed by worksheet name, each value an array of row objects.
FileNameStringOutput filename assigned to the JSON payload, e.g. report.txt.
SuccessBooleanWhether the extraction completed without error.

例子 JSON 回复

{
"document": "[Base64 JSON]",
"FileName": "report.txt",
"Success": true
}

提取 JSON 结构(从文档解码):

{
"Summary": [
{"Month": "January", "Revenue": 50000, "Expenses": 30000},
{"Month": "February", "Revenue": 55000, "Expenses": 32000}
],
"Sales": [
{"Product": "Widget A", "Quantity": 100, "Price": 10.50},
{"Product": "Widget B", "Quantity": 150, "Price": 15.75}
]
}

典型配置

工作流程示例Common Zapier workflow patterns using Extract Worksheets.
多张 API 分配
  1. 当合并报表工作簿进入 Google 云端硬盘文件夹时,会触发一个触发器。
  2. PDF4me 提取工作表映射文件和文件名,将工作表名称和工作表索引留空,以便将每个工作表作为一个整体提取。 JSON 字典。
  3. 格式化步骤会对 Base64 文档进行解码,然后各个步骤会将每个工作表的数据路由到各自的目标位置。 API
根据客户要求进行选择性导出
  1. 表单提交触发器用于捕获客户希望从共享主工作簿中选择哪些工作表。
  2. PDF4me 提取工作表会将工作表名称设置为请求的工作表列表(例如,“Q1,Q2”),以便只提取这些工作表。
  3. 解码 JSON 经过消毒处理后,将文件发送到客户门户网站或以附件形式通过电子邮件发送。
归档特定摘要标签页
  1. 每月最后一天会触发一个定时事件。
  2. PDF4me 提取工作表会将工作表索引设置为汇总标签的已知位置(例如,“1,2”),跳过详细信息表。
  3. 提取 JSON 写入数据库或 blob 存储步骤以进行长期保留。

实用技巧

File: (Exists but not shown) causes errors
Select the mapping option that provides the file's full binary content instead of a reference. See Zapier & Power Automate Tips for the exact steps.
Only File is required, everything else is optional
Leave Worksheet Names and Worksheet Indexes empty to extract every worksheet, there is no need to list sheet names if you want the whole workbook.
Names and Indexes combine, they do not filter each other
Setting both fields extracts the union of matching sheets, not the intersection. Use only one field if you want a strict match.
Worksheet Indexes start at 1, not 0
The first worksheet in the workbook is index 1. This trips up developers used to zero-based array indexing in other tools.
The output is JSON, not a spreadsheet file
Decode the Base64 document field to get the worksheet dictionary. There is no separate downloadable Excel file in this action's response.

速查表

场地价值
ActionExtract Worksheets
File[Mapped from previous step]
File Nameadd_header_sample_file.xlsx
Worksheet NamesSheet1, Sheet2 (optional)
Worksheet Indexes1,3 (optional, 1-based)
Output formatBase64-encoded JSON dictionary

常见问题

How do I extract a specific worksheet from an Excel file in Zapier?+
Add the PDF4me Extract Worksheets action to a Zap, map File and File Name from a previous step using the full-content option, then enter the sheet name in Worksheet Names or its position in Worksheet Indexes. See Zapier's guide to working with files for how file fields pass between steps.
Can I extract all worksheets from a workbook at once?+
Yes. Leave both Worksheet Names and Worksheet Indexes empty and PDF4me extracts every worksheet in the workbook into a single JSON dictionary keyed by sheet name.
What format is the extracted worksheet data returned in?+
The document field is a Base64-encoded JSON byte array. Decoded, it is a dictionary where each key is a worksheet name and each value is an array of row objects, using the first row of each sheet as the property names.
Is File the only required field?+
Yes. In the Zapier configuration, only File is marked required. File Name, Worksheet Names, and Worksheet Indexes are all optional.
How does Worksheet Indexes numbering work?+
Worksheet Indexes uses 1-based numbering, so the first worksheet in the workbook is index 1, the second is index 2, and so on, different from zero-based indexing used in many programming languages.

相关操作

在其他平台上执行相同任务

行业应用案例及应用

  • 多API数据源自动将不同的工作表提取到不同的系统 API。
  • 数据仓库加载将多工作表财务工作簿加载到数据仓库表中
  • 系统迁移:将完整的 Excel 工作簿提取为 JSON 格式,以便迁移到云系统
  • 数据备份将多工作表操作手册归档为 JSON 格式,以便进行灾难恢复
  • ETL管道在多步骤转换管道中,以中间格式提取工作表

获取帮助