본문으로 건너뛰기
Skillpedia
PDF, Word, 슬라이드7.8k · #12866

docx-read-fallback

하는 일

이 스킬은 다른 방법이 실패할 때 python-docx 라이브러리로 .docx 파일에서 텍스트, 표, 제목을 꺼내는 방법을 보여 줍니다. 다른 방법으로는 열 수 없는 Word 문서를 읽어야 하는 사람에게 맞습니다.

사용하는 경우

  • ✓.docx 파일에서 파일 리더가 실패하거나 시간 초과될 때.
  • ✓Word 문서의 텍스트, 표 또는 제목이 필요할 때.
  • ✓코드 샌드박스가 Word 파일을 읽지 못하는 경우.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/docx-read-fallback/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/docx-read-fallback/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“AI가 제 Word 파일을 열 수 없습니다. 텍스트와 표가 있다면 꺼내 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 셸에서 짧은 Python 명령을 실행합니다. 이 명령은 python-docx로 파일의 단락, 표 또는 제목을 출력합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

DOCX Read Fallback

When read_file or execute_code_sandbox fails to read .docx files, use run_shell with python-docx as a reliable workaround.

When to Use

  • read_file fails, times out, or returns errors on .docx files
  • execute_code_sandbox attempts to read the docx fail
  • You need to extract text content from a Word document
  • Multiple standard approaches have been exhausted

How to Use

Basic Text Extraction

python -c "import docx; doc = docx.Document('path/to/file.docx'); print('\n'.join([p.text for p in doc.paragraphs]))"

Using run_shell Tool

run_shell command="python -c \"import docx; doc = docx.Document('path/to/file.docx'); print('\n'.join([p.text for p in doc.paragraphs]))\"" timeout=60

Extract Paragraphs with Indices

python -c "import docx; doc = docx.Document('file.docx'); [print(f'P{i}: {p.text}') for i, p in enumerate(doc.paragraphs) if p.text.strip()]"

Extract Tables

python -c "import docx; doc = docx.Document('file.docx'); [[print([[cell.text for cell in row.cells] for row in table.rows]) for table in doc.tables]]"

Extract Headings (by style)

python -c "import docx; doc = docx.Document('file.docx'); [print(p.text) for p in doc.paragraphs if p.style.name.startswith('Heading')]"

Prerequisites

Ensure python-docx is available:

python -c "import docx; print('docx available')"

If not installed:

pip install python-docx

Tips

  • Use absolute paths to avoid working directory issues
  • Set appropriate timeout (30-60 seconds for large documents)
  • Escape quotes properly when embedding in shell commands
  • For large documents, extract content in chunks or filter by paragraph index
  • This approach bypasses file type detection issues in read_file

Example Workflow

  1. Try read_file on the .docx file
  2. If it fails, verify python-docx availability
  3. Use run_shell with the python-docx extraction command
  4. Parse the stdout to get document content
  5. Proceed with your analysis using the extracted text
자주 묻는 질문

python-docx는 무엇인가요?

Word 파일을 읽고 쓰는 Python 라이브러리입니다.

표도 읽을 수 있나요?

네, 가이드에는 표 내용을 출력하는 명령이 들어 있습니다.

무엇을 설치해야 하나요?

명령을 실행하기 전에 python-docx가 있어야 한다고 가이드가 안내합니다.

상세 정보

작성자의 원본 설명

Use run_shell with python-docx as reliable fallback when read_file fails on .docx files

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#12866
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬