mcpField
A
add-excel

add-excel

github.com/microsoft数据与数据库1.1k260 次安装今天更新
代码仓库

关于 add-excel

此技能用于向 Power Apps 项目添加 Excel Online 数据并配置工作簿表格,指导连接器设置与服务调用,随后检查 TypeScript 构建。

主要功能

  1. 01收集工作簿位置和表格信息
  2. 02添加 Excel Online 连接器
  3. 03配置 OneDrive 或 SharePoint 数据源
  4. 04向 Excel 表格添加行
  5. 05构建并记录项目状态

适用场景

  1. 01连接存储在 OneDrive 的工作簿
  2. 02使用 SharePoint 工作簿中的表格
  3. 03向已配置的 Excel 表格添加行

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/microsoft/power-platform-skills --skill add-excel

安装后在 Claude Code 中输入/add-excel确认已加载。

详细介绍

📋 共享说明:shared-instructions.md - 跨领域注意事项。

添加 Excel Online

工作流

  1. 检查 Memory Bank → 2. 收集信息 → 3. 添加连接器 → 4. 配置 → 5. 构建 → 6. 更新 Memory Bank

第 1 步:检查 Memory Bank

根据 shared-instructions.md 检查是否存在 memory-bank.md。

第 2 步:收集信息

询问用户:

  1. 工作簿位于何处?(OneDrive 或 SharePoint)
  2. 工作簿文件名
  3. 要访问工作簿中的哪些表
第 3 步:添加连接器

首先,查找连接 ID(参见 connector-reference.md):

运行 /list-connections 技能。在输出中查找 Excel Online (Business) 连接。如果没有,请引导用户使用特定于环境的 Connections URL 创建连接——根据上下文中的活动环境 ID(来自 power.config.json 或之前的步骤)构造该 URL:https://make.powerapps.com/environments/<environment-id>/connections → + New connection → 搜索连接器 → Create。

Excel Online 是表格数据源——需要 -c(连接 ID)、-d(驱动器)和 --table(工作簿中的表名):

# OneDrive workbook
pa app add data-source --connector excelonlinebusiness -c <connection-id> -d 'me' --table 'Table1'

# SharePoint workbook -- dataset is the document library path
pa app add data-source --connector excelonlinebusiness -c <connection-id> -d 'sites/your-site' --table 'Table1'

为用户需要的每个表运行一次。

第 4 步:配置

AddRowIntoTable —— 向 Excel 表中添加一行:

// OneDrive workbook
await ExcelOnlineBusinessService.AddRowIntoTable({
  source: "me",
  drive: "me",
  file: "MyWorkbook.xlsx",
  table: "Table1",
  body: { column1: "value1", column2: "value2" } // Flat object, NO "items" wrapper
});

// SharePoint workbook
await ExcelOnlineBusinessService.AddRowIntoTable({
  source: "sites/your-site",
  drive: "drive-id",
  file: "SharedWorkbook.xlsx",
  table: "Table1",
  body: { column1: "value1", column2: "value2" }
});

要点:

  • OneDrive 个人文件使用 source: "me" 和 drive: "me"
  • 对于 SharePoint,使用站点路径和驱动器 ID
  • body 是与列标题对应的扁平键值对象——不要将其包装在 { items: ... } 中

使用 Grep 在 src/generated/services/ExcelOnlineBusinessService.ts 中查找特定方法(生成的文件可能非常大——参见 connector-reference.md)。

第 5 步:构建
npm run build

继续之前先修复 TypeScript 错误。此时不要部署。

第 6 步:更新 Memory Bank

在 memory-bank.md 中更新以下内容:已添加连接器、已配置工作簿/表、构建状态。

评论

支持 Markdown