Copy/Paste from several Excel rows/columns instead of variable/Alt+Tab

As of right now, I have KM Alt-Tab over to Excel and acquire the "Repeat Actions Count Times" from cell A2 (see included image). Next, scroll through B3, C3, D3 and copies each to its own variable (ie v1, v2, v3). Before switching windows, selected field moves Down, Left, Left to go to the next row (B4). Then, Alt-Tabs over and Pastes each v# to Pages separate table fields (MacOS).

What I need is a method that eliminates Alt-Tabbing/window switching. Can data be acquired for the variables all at once and just move to the next without switching window to Excel to acquire?

After all 3 variables are pasted in Pages, the page is exported into PDF. In other words, each row is a unique PDF page. Basically, my project is a flyer with different % discount for each company. Pages on MacOS allows for formulas so by pasting % in hidden tables, I export different company flyers.

You can look at the For Each-action.
Because if you copy the entire tabel once at the start of the macro, you can loop over each line in the clipboard with the For Each-action.

Hey Nick,

You can grab all of your data at once with an AppleScript without having to activate Excel.

Then you can massage it into a format Keyboard Maestro can work with an continue your process.

-Chris

I suspect you've already thought about it, but something that natively supports mail merging might be what you need. I use KM to massage MS Office's mail merge and it works quite nicely for me.

Hi, thanks for your response. Can you elaborate a little bit more. Maybe, point me to an example.