Automating logging of wordcount in Pages?

I write using Pages. It’s central to my workflow, so other programs aren’t an option, at least not for writing. I’d like to start logging my qord count each day.

I could do this manually by getting the starting count in my document and then checking the end count at the end of the day, finding the difference, and putting it in a spreadsheet. But hey, maybe I can automate this. Imcould see:

  1. Directly doing it with pages on ios. —> this seems doubtful. I know iwork added shortcuts, but I don’t think they’re extensive.
  2. Opening the pages file in another program or with shortcuts, and getting a word count. Do this in morning and evening and log the result
  3. Somehow do it on macos. I have no mac automation experience though

Any ideas? I’ve made shortcuts, but am not sure what can read .pages files and so am unsure where to start with this or if it’s even possible. Lwt me know if this seems more like a mac thing. Thanks!

With shortcuts, you can count the words of a document by converting it to PDF first but I’m not sure about how accurate the count is compared to Pages since I haven’t checked.

Shortcut Steps
Get File ['Show Document Picker'=On]
Make PDF
Count [Words]

If you’re comfortable enough with building shortcuts, you can adapt it to choose multiple files and sum up the word counts.

Oh perfect, that worked! Didn’t realize Shortcuts could process .pages files, that’s great.

Wordcount was off by about 2000. But, I did a test by adding five words, and both Pages and Shortcuts counted an increase of five. I’ll check manually the first few times, but this should be good for counting the change.

One hitch: I’ve been working in iCloud Drive in Pages. So the file is in the Pages app. Is shortcuts able to access this in the iCloud document picker, or do I have to switch the file’s location to “Shortcuts” or switch to Dropbox?

I would prefer Dropbox, except I found save wasn’t working well the last time I tried on iOS: it kept making duplicates of the file.

As for the logging, what I think I’ll do is:

Add a step “morning or evening”?

If morning, add an entry with the date to the “morning” column in a spreadsheet.
If evening, add an entry to the “evening” column of that same day.

Then it can read me the output, and I can log those somewhere on a dashboard to read them. I’ve been using numerics to make dashboards. They have a csv entry so it should work.

This last bit is just for my own memory, but it occurred to me I can log pomodoros via shortcut also to a spreadsheet, and put that into a dashboard. Maybe:

  1. Ask for task description
  2. Set timer for 25 min
  3. Log task to spreadsheet

Then I could read a total number of pomodoros and a daily average for each month, or something. I’ve always struggled with time tracking, but I’m decent at doing the pomodoro method.