But probably what you want to do is process the data in the text. So here's my emacs function for this (not the code for the data processing itself which was done in Python, separately - but see how you can go combine those together).
(defun refresh (arg)
"Rerun local file creation & open in Firefox"
(interactive)
(let ((filearg (concat "ruby project_refresh_emacs.rb " arg)))
(shell-command filearg))
(message "refreshed file for you")
)