Copy a range of cells from excel and paste individually using find and replace in pages

I am having issues creating a macro to copy a range of excel cells (with text in them) and pasting the text from each cell individually into different places in pages. I have used information from other posts to try and create this but am still having issues. (Copy & Paste from Excel Cells to Individual Clipboards).

The purpose for this is to move quotes from an excel list to my planner which I print termly. I update this quote list as I find new quotes that I want into my planner planner template. I am still compiling the list of quotes and will have over a 100 once complete.

For the purposes of illustration I have include included screen shots of sample excel sheet with just 3 quotes and in turn the pages document with just 3 pages with relevant locations to insert the quotes

This is how I am trying to do:

  1. Select the relevant cells in excel

  2. copy the information in them to the system clipboard


    46
    Up to this point it is all working

2 Capture these separate cells and save to variables using action 'search using regular expression'
47
This action is not working - I took this action from the macro outlined in this post (Copy & Paste from Excel Cells to Individual Clipboards)

I think it is in this action where something is going wrong.

  1. I then want to be able to use the 'find and replace' function in pages to then paste these variables into a pages template I have created
    06 21 29

To do this I activate pages
17

Then I use the find and replace function and insert the variables into the relevant places in my pages template. I repeat this set of actions for each variable - I have used this set of actions together with the 'prompt for user input' so I know this bit works
22

Any help appreciated.

That would be because the values from Excel are separated by CR or LF, not by a TAB:

image

It is always best to develop/confirm any RegEx using Regex101.com (or similar tool)

We could write a RegEx for a specific number of Excel cells, but it might be better to write a more comprehensive macro to handle a variable number of cells, something like this:

Here is an EXAMPLE macro to give you some ideas. You will need to modify to suit you specific workflow. Please let us know if this works for you.

MACRO:   Extract Excel Cells on Separate Lines [Example]

~~~ VER: 1.0    2019-11-17 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Extract Excel Cells on Separate Lines [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


I have just posted a major revision to my above Macro that should be much faster and more reliable, since it uses the macOS Find Pasteboard instead filling in the data for the Find Dialog.

Please note that since I wrote this to be for more general use, I have change the Pages placeholder text.

MACRO: Replace Text in Pages with Data from Excel [Example]