0

How can I read through a doc file and get the rows of a specific table from it using Python? Later I'll be manipulating the string obtained from this table.

Table will have caption/table name so may be I can use that to find the table when the doc is getting parsed.

I've no idea how to read through doc and have only basic Python knowledge, but I'm trying to simplify one of my daily tasks which involves manually copy pasting from table and editing it.

Thank you,


So far I've got this much

import win32com.client as win32
word = win32.Dispatch("Word.Application")
word.Visible = 0
word.Documents.Open("C:\Python27\programs\my.doc")
doc = word.ActiveDocument
count = doc.Tables.Count
print count

Is there a way to find the specific table I want? I was thinking may be I can read the caption of table somehow, any way to achieve this?

akhilc
  • 181
  • 4
  • 19

1 Answers1

1

This blog post might be of interest. There should be quite a few relevant posts on SO as well, just a search away. Here's one.

Community
  • 1
  • 1