← 返回 Skills 市场
tomasz-pedzierski-infinity

Email Excel Transfer

作者 Tomasz-Pedzierski-Infinity · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
41
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install email-excel-transfer
功能描述
Pobieranie załączników z maila przez IMAP i wypełnianie plików Excel przez PowerShell. Użyj gdy użytkownik prosi o pobranie plików z email i wstawienie warto...
使用说明 (SKILL.md)

Email → Excel Transfer

Kompletny workflow: pobranie załączników z maila WP → odczyt danych → wypełnienie pliku Excel.

1. Pobranie załączników z maila (IMAP)

import imaplib, ssl, os, base64, time
import email

m = imaplib.IMAP4_SSL('imap.wp.pl', 993, ssl_context=ssl.create_default_context())
m.login('USER_EMAIL', 'USER_APP_PASSWORD')
m.select('INBOX')
time.sleep(0.5)
_, messages = m.search(None, 'FROM "[email protected]" SUBJECT "fraza"')
ids = messages[0].split()
uid = ids[-1]  # najnowszy
_, msg_data = m.fetch(uid, '(RFC822)')
msg = email.message_from_bytes(msg_data[0][1])

os.makedirs('/tmp/mail_attachments', exist_ok=True)
for part in msg.walk():
    if part.get_content_disposition() == 'attachment':
        filename = part.get_filename()
        data = part.get_payload(decode=True)
        if data and 'xlsx' in filename:
            if '=?utf-8?b?' in filename:
                fname = base64.b64decode(filename.split('?')[3]).decode('utf-8')
            else:
                fname = filename
            with open(f'/tmp/mail_attachments/{fname}', 'wb') as f:
                f.write(data)
m.logout()

2. Odczyt danych z plików xlsx

Pliki xlsx to pliki ZIP. Odczyt bez zewnętrznych bibliotek:

import zipfile, re

def read_xlsx(path):
    with zipfile.ZipFile(path) as z:
        with z.open('xl/worksheets/sheet1.xml') as f:
            content = f.read().decode('utf-8')
        with z.open('xl/sharedStrings.xml') as f:
            ss = f.read().decode('utf-8')
    strings = re.findall(r'\x3Ct[^>]*>([^\x3C]+)\x3C/t>', ss)
    cells = re.findall(r'\x3Cc r="([A-Z]+\d+)"([^>]*)>(.*?)\x3C/c>', content, re.DOTALL)
    data = {}
    for cell_ref, attrs, cell_content in cells:
        v = re.search(r'\x3Cv>([^\x3C]+)\x3C/v>', cell_content)
        if v:
            val = v.group(1)
            if 't="s"' in attrs:
                idx = int(val)
                val = strings[idx] if idx \x3C len(strings) else val
            data[cell_ref] = val
    return data

3. Wypełnianie pliku Excel (PowerShell + COM)

Add-Type -AssemblyName Microsoft.Office.Interop.Excel
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
$wb = $excel.Workbooks.Open("C:\sciezka\do\pliku.xlsx")
$ws = $wb.ActiveSheet

# Wstawianie wartości (row, col) - Excel kolumny: B=2, C=3, D=4, E=5, F=6, G=7, H=8
$ws.Cells.Item(6,5).Value2 = 2450000  # E6
$ws.Cells.Item(6,6).Value2 = 2380000  # F6
$ws.Cells.Item(6,7).Value2 = 2520000  # G6
$ws.Cells.Item(6,8).Value2 = 7350000  # H6

$wb.Save()
$wb.Close($false)
$excel.Quit()

4. Przesyłanie plików na Windows (MCP bridge)

MCP bridge: http://172.17.0.1:3001/mcp (dostępne tylko z VM Linux)

Małe pliki (\x3C200KB):

import base64, json

with open('/tmp/plik.xlsx', 'rb') as f:
    b64 = base64.b64encode(f.read()).decode()

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
        "name": "shell_ps",
        "arguments": {
            "cmd": f'[IO.File]::WriteAllBytes("C:\\sciezka\\plik.xlsx", [Convert]::FromBase64String("{b64}"))'
        }
    }
}

Duże pliki — etapami:

  1. fs_write → zapisz base64 do TEMP
  2. shell_ps[IO.File]::WriteAllBytes odczytuje z TEMP

Dane logowania (do uzupełnienia przez użytkownika)

  • Email: USER_EMAIL (np. [email protected])
  • Hasło aplikacji: USER_APP_PASSWORD
  • IMAP: imap.wp.pl:993

Szablony PowerShell

Wstawianie wielu wartości:

$ws.Cells.Item(row, col).Value2 = value
# Row 6-20 = wiersze danych, Kolumny E(5), F(6), G(7), H(8)

Pełny workflow (odczyt → modyfikacja → zapis):

Add-Type -AssemblyName Microsoft.Office.Interop.Excel
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
$wb = $excel.Workbooks.Open("C:\sciezka\wejsciowa.xlsx")
$ws = $wb.ActiveSheet

# Wstaw wartości
$ws.Cells.Item(6,5).Value2 = 2450000
# ... więcej komórek

$wb.SaveAs("C:\sciezka\wyjsciowa.xlsx", 51)  # 51 = xlsx
$wb.Close($false)
$excel.Quit()
安全使用建议
Before installing, confirm you trust the skill author and understand where credentials and files will go. Specific actions to consider: - Ask the maintainer to declare required env vars (USER_EMAIL, USER_APP_PASSWORD) in metadata so you know what you'll be asked to provide. - Prefer using an app-specific IMAP password or a throwaway account, not your primary mailbox password. - Verify the MCP bridge endpoint (http://172.17.0.1:3001/mcp) is a trusted internal service in your environment — this endpoint can write files and execute PowerShell on a Windows host, which is high privilege. - If possible, test with non-sensitive emails/attachments on an isolated VM before giving real credentials or permitting remote execution. - Review and limit the PowerShell commands that will be executed; avoid allowing arbitrary shell_ps calls that could run unexpected code. If you cannot verify the bridge or do not want to share email credentials, do not install or use this skill.
功能分析
Type: OpenClaw Skill Name: email-excel-transfer Version: 1.0.0 The skill bundle facilitates a workflow for downloading email attachments via IMAP and automating Excel on a Windows host using a PowerShell bridge. It contains high-risk capabilities, specifically the use of an MCP bridge (http://172.17.0.1:3001/mcp) to execute arbitrary PowerShell commands (shell_ps) on a remote Windows system from a Linux environment. While these functions align with the stated purpose in SKILL.md, the combination of email credential handling and remote command execution represents a significant attack surface without built-in safeguards.
能力标签
crypto
能力评估
Purpose & Capability
The name/description match the instructions: the SKILL.md shows IMAP download, XLSX parsing, and PowerShell-based Excel edits. However, the skill requires user email credentials (USER_EMAIL, USER_APP_PASSWORD) and access to a Windows host for COM automation, but the registry metadata lists no required environment variables or primary credential — an inconsistency between claimed purpose and declared requirements.
Instruction Scope
Runtime instructions tell the agent to log into IMAP with user-supplied credentials, save attachments to /tmp, parse XLSX, then transfer files to a Windows host and run PowerShell COM to edit Excel. The SKILL.md also demonstrates sending base64 payloads to an internal MCP bridge (http://172.17.0.1:3001/mcp) and invoking a remote shell_ps tool. That bridge/JSON-RPC execution path grants the ability to write files and run arbitrary PowerShell on another host — legitimate for the stated transfer task but high-impact and not restricted or explained.
Install Mechanism
This is an instruction-only skill with no install spec and no code files. Nothing is written to disk by the skill itself before runtime, which lowers install-time risk.
Credentials
The instructions require sensitive secrets (email address and app password) and access to an internal MCP bridge that can execute PowerShell — yet the skill metadata declares no required env vars or primary credential. Requiring these credentials is reasonable for IMAP access, but the omission in metadata is a transparency issue. The MCP bridge endpoint (172.17.0.1) is an internal address and using it to execute PowerShell increases the trust and privilege needed.
Persistence & Privilege
The skill is not marked always:true and has no install-time persistence. It does instruct use of a remote execution bridge, but it does not request permanent inclusion or to modify other skills/configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install email-excel-transfer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /email-excel-transfer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the email-excel-transfer skill. - Supports downloading email attachments from WP mail via IMAP. - Reads data from .xlsx files without external Python libraries. - Fills Excel files using PowerShell and Microsoft Office Interop. - Provides sample scripts and workflow for transferring files between Linux and Windows using MCP bridge. - Includes clear templates and instructions for user customization.
元数据
Slug email-excel-transfer
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Email Excel Transfer 是什么?

Pobieranie załączników z maila przez IMAP i wypełnianie plików Excel przez PowerShell. Użyj gdy użytkownik prosi o pobranie plików z email i wstawienie warto... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。

如何安装 Email Excel Transfer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install email-excel-transfer」即可一键安装,无需额外配置。

Email Excel Transfer 是免费的吗?

是的,Email Excel Transfer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Email Excel Transfer 支持哪些平台?

Email Excel Transfer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Email Excel Transfer?

由 Tomasz-Pedzierski-Infinity(@tomasz-pedzierski-infinity)开发并维护,当前版本 v1.0.0。

💬 留言讨论