मुख्य सामग्री पर जाएँ
Skillpedia
PDF, Word और स्लाइड7.8k · #12866

docx-read-fallback

यह क्या करती है

यह स्किल AI को दिखाती है कि जब सरल तरीके विफल हों, तो python-docx लाइब्रेरी से .docx फ़ाइल से टेक्स्ट, टेबल और हेडिंग कैसे निकालें। यह उन लोगों के लिए है जिन्हें ऐसी Word फ़ाइलें पढ़वानी हैं, जिन्हें AI अन्यथा नहीं खोल पाता।

कब इस्तेमाल करें

  • ✓जब .docx फ़ाइल पर फ़ाइल रीडर विफल हो या टाइम आउट हो।
  • ✓जब मुझे Word दस्तावेज़ का टेक्स्ट, टेबल या हेडिंग चाहिए।
  • ✓जब कोड सैंडबॉक्स Word फ़ाइल न पढ़ सके।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/docx-read-fallback/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“AI मेरी Word फ़ाइल नहीं खोल पा रहा। कृपया उसमें से टेक्स्ट और कोई टेबल निकालिए।”

हर हफ़्ते 5 नई skills, 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
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills