add-excel

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
📋 Shared Instructions: shared-instructions.md - Cross-cutting concerns.
📋 通用说明: shared-instructions.md - 跨领域相关事项。

Add Excel Online

添加Excel Online

Workflow

工作流程

  1. Check Memory Bank → 2. Gather → 3. Add Connector → 4. Configure → 5. Build → 6. Update Memory Bank

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

Step 1: Check Memory Bank

步骤1: 检查记忆库

Check for
memory-bank.md
per shared-instructions.md.
按照shared-instructions.md的要求检查
memory-bank.md

Step 2: Gather

步骤2: 收集信息

Ask the user:
  1. Where is the workbook? (OneDrive or SharePoint)
  2. Workbook file name
  3. Which table(s) in the workbook to access
询问用户以下问题:
  1. 工作簿位置?(OneDrive 或 SharePoint)
  2. 工作簿文件名
  3. 要访问的工作簿中的哪些表格

Step 3: Add Connector

步骤3: 添加连接器

First, find the connection ID (see connector-reference.md):
Run the
/list-connections
skill. Find the Excel Online (Business) connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from
power.config.json
or a prior step):
https://make.powerapps.com/environments/<environment-id>/connections
+ New connection → search for the connector → Create.
Excel Online is a tabular datasource -- requires
-c
(connection ID),
-d
(drive), and
-t
(table name in workbook):
bash
undefined
首先,查找连接ID(请参阅connector-reference.md):
运行
/list-connections
技能。在输出结果中找到Excel Online (Business)连接。如果不存在,请引导用户使用特定环境的连接URL创建连接——根据上下文(来自
power.config.json
或之前步骤)中的活动环境ID构造URL:
https://make.powerapps.com/environments/<environment-id>/connections
+ 新建连接 → 搜索该连接器 → 创建。
Excel Online是表格数据源——需要
-c
(连接ID)、
-d
(驱动器)和
-t
(工作簿中的表格名称):
bash
undefined

OneDrive workbook

OneDrive工作簿

pwsh -NoProfile -Command "pac code add-data-source -a excelonlinebusiness -c <connection-id> -d 'me' -t 'Table1'"
pwsh -NoProfile -Command "pac code add-data-source -a excelonlinebusiness -c <connection-id> -d 'me' -t 'Table1'"

SharePoint workbook -- dataset is the document library path

SharePoint工作簿 -- 数据集为文档库路径

pwsh -NoProfile -Command "pac code add-data-source -a excelonlinebusiness -c <connection-id> -d 'sites/your-site' -t 'Table1'"

Run for each table the user needs.
pwsh -NoProfile -Command "pac code add-data-source -a excelonlinebusiness -c <connection-id> -d 'sites/your-site' -t 'Table1'"

为用户需要的每个表格运行上述命令。

Step 4: Configure

步骤4: 配置

AddRowIntoTable -- adds a row to an Excel table:
typescript
// 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" }
});
Key points:
  • source: "me"
    and
    drive: "me"
    for OneDrive personal files
  • For SharePoint, use the site path and drive ID
  • The
    body
    is a flat key-value object matching column headers -- do NOT wrap in
    { items: ... }
Use
Grep
to find specific methods in
src/generated/services/ExcelOnlineBusinessService.ts
(generated files can be very large -- see connector-reference.md).
AddRowIntoTable -- 向Excel表格添加一行:
typescript
// OneDrive工作簿
await ExcelOnlineBusinessService.AddRowIntoTable({
  source: "me",
  drive: "me",
  file: "MyWorkbook.xlsx",
  table: "Table1",
  body: { column1: "value1", column2: "value2" } // 扁平对象,请勿使用"items"包裹
});

// SharePoint工作簿
await ExcelOnlineBusinessService.AddRowIntoTable({
  source: "sites/your-site",
  drive: "drive-id",
  file: "SharedWorkbook.xlsx",
  table: "Table1",
  body: { column1: "value1", column2: "value2" }
});
关键要点:
  • source: "me"
    drive: "me"
    适用于OneDrive个人文件
  • 对于SharePoint,请使用站点路径和驱动器ID
  • body
    是与列标题匹配的扁平键值对象——请勿用
    { items: ... }
    包裹
使用
Grep
src/generated/services/ExcelOnlineBusinessService.ts
中查找特定方法(生成的文件可能非常大——请参阅connector-reference.md)。

Step 5: Build

步骤5: 构建

powershell
npm run build
Fix TypeScript errors before proceeding. Do NOT deploy yet.
powershell
npm run build
在继续之前修复所有TypeScript错误。暂不部署。

Step 6: Update Memory Bank

步骤6: 更新记忆库

Update
memory-bank.md
with: connector added, workbook/table configured, build status.
memory-bank.md
中更新以下内容:已添加连接器、已配置工作簿/表格、构建状态。