AgentMarketMCP / SKILL 资产档案馆

目录 / 云服务与运维 / inserts3imagesintoexcelfromdataframe

SKILL 未评级 已上架

inserts3imagesintoexcelfromdataframe

遍历存储在 pandas DataFrame 中的 S3 键,使用 boto3 获取图像,并将它们作为实际图像嵌入到 Excel 文件中。 ```python import pandas as pd import boto3 from io import BytesIO from openpyxl import Workbook from openpyxl.drawing.image import Image as OpenpyxlImage import os # 初始化 S3 客户端 s3_client = boto3.client('s3') # 假设 df 是包含 S3 key 的 DataFrame,列名为 's3_key' # df = pd.read_csv('your_data.csv') # 或其他方式加载数据 # 创建 Excel 工作簿和工作表 wb = Workbook() ws = wb.active ws.title = "Images from S3" # 设置列标题 ws.append(["S3 Key", "Image"]) # 遍历 DataFrame 中的每一行 for index, row in df.iterrows(): s3_key = row['s3_key'] bucket_name = 'your-bucket-name' # 替换为你的 S3 bucket 名称 try: # 从 S3 获取对象 response = s3_client.get_object(Bucket=bucket_name, Key=s3_key) image_data = response['Body'].read() # 将图像数据加载到内存中 img_stream = BytesIO(image_data) # 创建 openpyxl 图像对象 img = OpenpyxlImage(img_stream) # 可选:调整图像大小(例如宽度为 100 像素) img.width = 100 img.height = 100 # 写入 S3 key 到第一列 ws.cell(row=index + 2, column=1, value=s3_key) # 将图像插入到第二列(B 列) ws.add_image(img, f'B{index + 2}') except Exception as e: print(f"Error processing {s3_key}: {e}") ws.cell(row=index + 2, column=1, value=s3_key) ws.cell(row=index + 2, column=2, value="Failed to load") # 保存 Excel 文件 output_file = "s3_images.xlsx" wb.save(output_file) print(f"Excel file saved as {output_file}") ``` 注意:请确保已安装所需库:`pandas`, `boto3`, `openpyxl`,并且 AWS 凭证已正确配置。

模型生成摘要(rules/v1 · 2026-11-03 14:16):遍历存储在 pandas DataFrame 中的 S3 键,使用 boto3 获取图像,并将它们作为实际图像嵌入到 Excel 文件中
这是模型对公开材料的总结,不是官方声明,请以原链内容为准。

存档时间线

版本存档时间内容哈希内容
v12026-11-03 14:1662e0639a 可取

版本索引永久保留;内容副本只保留最新 1 份,更早版本仅留索引与哈希(存档时间线的证据链不会因此断裂)。

下载存档内容副本

相关资产

MCP 需 API Key

Document to Markdown & RAG Chunks

Convert PDF, Word, PowerPoint, Excel, HTML and EPUB files into clean Markdown for LLMs, including OCR for scanned PDFs a…

MarkdownRAGPDF 处理Office 转换ERPExcel 操作
原作者:p-d-tashev 来源:Smithery 仅卡片存档
MCP 需 API Key

pdf-toolkit

PDF Toolkit converts PDFs/images to Word, Excel, and Markdown, splits and merges PDFs, creates PDFs from images, adds te…

PDF 处理Office 转换Excel 操作Markdown
原作者:bob-rsef 来源:Smithery 仅卡片存档
MCP 需 API Key

quickS3

Give your AI agent access to S3-compatible storage **without handing it your access keys**

对象存储RAG
原作者:quicks3 来源:Smithery 仅卡片存档
MCP 需 API Key

GoldenFlow

Standardize, reshape, and normalize messy data — CSV, Excel, Parquet, S3, databases

Excel 操作对象存储
原作者:benzsevern 来源:Smithery 仅卡片存档
MCP 需 API Key

Excel

Create and edit Excel workbooks, read and update worksheets, cells, and ranges, search workbooks, scan for data issues, …

Excel 操作
原作者:excel 来源:Smithery 仅卡片存档
MCP 需 API Key

Data Converter

Convert data between over 40 formats including JSON, CSV, Excel, and PDF

Excel 操作
原作者:data-transform-agent 来源:Smithery 仅卡片存档
纠错与举报(发现条目失效、署名有误或涉及侵权?)
提交举报 / 纠错

侵权举报经核验成立后,我们会即时下线该条目并删除已存的内容副本。