Word count


I have a list of 1000 web url’s in Excel and I would like to:

“ get the urls from cell A1 to A1000

  • get the text from the webpage
  • count words
  • paste values into cell B1 to B1000

I’m using this bit to count words:

on run {input, parameters}
	set word_count to count words of (input as string)
	display alert "Words: " & word_count
	return input
end run

But I don’t know how to do the rest, any ideas?


Assuming you have the excel file open, then this would get those URLs in a list. Then you could repeat through the list, and use the command line tool “curl” to get the URL text.

tell application "Microsoft Excel"
	tell active sheet of active workbook
		set theRange to "A1:A1000"
		set theURLs to value of range theRange
	end tell
end tell

repeat with i from 1 to count of theURLs
	set thisURL to item 1 of (item i of theURLs)
	-- do something with thisURL
end repeat