← Back to Skills Marketplace
tomasz-pedzierski-infinity

Email Excel Transfer

by Tomasz-Pedzierski-Infinity · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
41
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install email-excel-transfer
Description
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...
README (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()
Usage Guidance
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.
Capability Analysis
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.
Capability Tags
crypto
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install email-excel-transfer
  3. After installation, invoke the skill by name or use /email-excel-transfer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug email-excel-transfer
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 41 downloads so far.

How do I install Email Excel Transfer?

Run "/install email-excel-transfer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Email Excel Transfer free?

Yes, Email Excel Transfer is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Email Excel Transfer support?

Email Excel Transfer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Email Excel Transfer?

It is built and maintained by Tomasz-Pedzierski-Infinity (@tomasz-pedzierski-infinity); the current version is v1.0.0.

💬 Comments