Creating Client Files from Excel Database

I am relatively new to Keyboard Maestro, but can't help myself from jumping into the deep end...

I have an Excel workbook with a sheet that contains a database of clients. For this example, the first name is in column B, last name is in column C. I may have a 150 entries.

My goal is to create a folder for each client in the database by name (last name, first name). I am not sure where to begin to extract the data from Excel and have no scripting experience. Any suggestions of where to start?

Fortunately, KM has an action for just this sort of scenario, appropriately called "For Each". Once you know how it works, and with a little bit of regex, this task is simpler than you might think. Here's an example macro that should get you most of the way there:

New Folder for Each Name in Clipboard.kmmacros (2.4 KB)
image

Once you have this macro installed and enabled, all you need to do is change the folder path in the "Create New Folder" action to the one where you want the new folders created, copy the name data from Excel, and run the macro.

Test Source Data
51%20AM

Resulting Folders
48%20AM

3 Likes

for each (the lines in system clipboard) is great. Thanks

1 Like

Hey Dani

I'm taking a different tack from Gabe's offering by using AppleScript to acquire data from the selection in Microsoft Excel and then make the folders in the Finder.

(I don't like using the Clipboard with Microsoft apps, because they add copious invisible data-types to it – and this can sometimes cause Keyboard Maestro macros to hang.)

Borrowing Gabe's test data:

image

Test Data as Text
Phyllis	Alvarez
Amanda	Arnold
Andrew	Carter
Tammy	Coleman
Janet	Fernandez
Joyce	Fisher
Denise	George
Rebecca	Gibson
Melissa	Hamilton
Terry	Hansen
Marilyn	Hunt
Eugene	Jones
Kathleen	Meyer
Robin	Mitchell
Ernest	Nelson
Douglas	Perez
Alan	Ramirez
Amy	Reyes
Kimberly	Spencer
Phillip	Stone

The client folder is created if it doesn't already exist.

Names are skipped if they already exist.

The final actions of the macro are to switch to the Finder and open the client folder.

-Chris


Create Client Folders in the Finder from Selection in Excel v1.00.kmmacros (7.5 KB)

1 Like