Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a program that takes a Microsoft Word document and produces a spreadsheet of all the words contained in the document and the number of times the word appears?


cat 23

said 15

jumped 12

dog 7


I appreciate the answers regarding VBA macros, but I was hoping for a readily available tool (open source, shareware or commercial) that can handle this task.

share|improve this question

closed as off-topic by fixer1234, DavidPostill, Deltik, random May 2 at 13:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – fixer1234, DavidPostill, Deltik, random
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

Apart from VBA, one can develop such an application using API of OpenOffice to read the contents of the Word document; process it and export the results as a CSV file to open in a spreadsheet application.

However it's actually just a few line of codes if you're familiar with any programming language. For example in Python you can easily do it like that:

Here we define a simple function which counts words given a list

def countWords(a_list):
    words = {}
    for i in range(len(a_list)):
        item = a_list[i]
        count = a_list.count(item)
        words[item] = count
    return sorted(words.items(), key = lambda item: item[1], reverse=True)

The rest is to manipulate the content of the document.First paste it:

content = """This is the content of the word document. Just copy paste it. 
It can be very very very very long and it can contain punctuation 
(they will be ignored) and numbers like 123 and 4567 (they will be counted)."""

Here we remove the punctuation, EOL, parentheses etc. and then generate a word list for our function:

import re

cleanContent = re.sub('[^a-zA-Z0-9]',' ', content)

wordList = cleanContent.lower().split()

Then we run our function and store its result (word-count pairs) in another list and print the results:

result = countWords(wordList)

for words in result:

So the result is:

('very', 4)
('and', 3)
('it', 3)
('be', 3)
('they', 2)
('will', 2)
('can', 2)
('the', 2)
('ignored', 1)
('just', 1)
('is', 1)
('numbers', 1)
('punctuation', 1)
('long', 1)
('content', 1)
('document', 1)
('123', 1)
('4567', 1)
('copy', 1)
('paste', 1)
('word', 1)
('like', 1)
('this', 1)
('of', 1)
('contain', 1)
('counted', 1)

You can remove parentheses and comma using search/replace if you want.

All you need to do download Python 3, install it, open IDLE (comes with Python), replace the content of your word document and run the commands one at a time and in the given order.

share|improve this answer

Use VBA; a script to do exactly what you request is towards the bottom of this page.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.