Look up other emails from a spreadsheet

I’m not sure whether Shortcuts or Scriptable (or both?) could handle going into a spreadsheet like I need for this task, so I didn’t drop it in either sub-forum.

I’m a teacher, and when I receive an email from a student, I like to follow my school’s guidelines of CC’ing their parents. This is fine on my Mac, because I just pop open the spreadsheet and grab their parents’ emails. On my iPhone, this task feels much more arduous. Is there a way to use Shortcuts, Scriptable, or any other tool to take the “from” email address, search for it in a spreadsheet, and grab the other associated items in that row?

Does it have to be a spreadsheet, or would a text/CSV file suffice?

You could have an automation on your Mac that periodically exports a plainer version to somewhere (e.g. iCloud, Dropbox), that could then be read on iOS by either app you mention, and you could match using regex.

It would be possible to do this in Shortcuts.
Run the shortcut to get a list of students.
The shortcut then uses a dictionary to copy the emails to the clipboard.

It’s a bit more fiddly, but you can either program the dictionary into the Shortcut, or use a txt file lookup. I did something using this technique to pick a random student that I could share if it sounds useful.

I should convert it to a CSV file to get this working on my Mac as well as a time-saving matter. Is learning regex as reasonable as this post is mentioning?

@GraemeS I’d love an example to start working off of, just because I haven’t gotten deep enough into my own Shortcuts that I have dictionaries to deal with.

Regex is not too scary if you just want some basics, though I’m a newbie myself.
Here’s a link to my random student picker (though I don’t know if better methods are possible).

Regular expressions can vary in complexity, just like creating a Shortcut, or writing some JavaScript in Scriptable. If you ever work with processing text (and who doesn’t?), then in my opinion you should be looking at familiarising yourself with regular expressions.

Time spent getting familiar with regular expressions will pay dividends in the future allowing you to process text quickly, enabling you to do things you otherwise would have no idea how to approach, etc.

A few suggestions:

  1. Read through a few tutorials written by different people.
  2. Do use a tool to help you try stuff out. Search this forum and you’ll find plenty of recommendations.
  3. Do not try and learn it all at once. RegEx is kind of a programming language in its own right and no one sits down and tries to learn an entire language in a single sitting. Learn enough to solve your first problem then come back later to learn more.