How Do I Copy and Paste from Excel to Website?

Hi community of KM!

I’m trying to copy from excel (CSV) to a website and the cell starts from A through E, to i (it depends). I have to copy and paste specific cells into a specific text area (this part I know how to do). I’m currently using click mouse functions to do this, but I want to do this without it. Please also note that my macro isn’t fully automatic, meaning I have to go to click next page and let it do the work and click next page.

I’ve been looking at different methods available here but I’m too noob to understand these concepts. Please help!

Can you please upload/post:

  1. Example Excel file (need to zip first)
  • Please use real-world data (but nothing sensitive)
  • A small, representative sample is all that is needed
  1. Web page you want to paste into
  • URL
  • screenshot (of just the area where you need to paste)
  1. Existing macro if you have one

This will help us help you better, faster, without any false starts.


(NOTE: I adjusted your topic title to be more clear. Please let me know if you have any objections.) (11.7 KB) (you'll need pro account to do it, but I'll provide what I can)

My Macro


Thanks. This is very helpful, but unfortunately I don't have a pro account, so I can't see the form you posted.

But you can do this:

Instead of "Select Chrome Field" and the "Paste", just use

"Set Chrome Field"

I'll be back to show you how to set KM Variables from the Excel file.

So does this mean that I’ll have to set the variables on excel to specifics?

This CSV file does NOT have:

  • City
  • Zip

Which fields on the form do you want to fill in?

EDIT: Do you want to process all rows in the Excel file, or just selected rows?

Could you fill in a form manually, and then make a screen shot of the form?

I'd prefer to have an Excel file rather than a CSV file.

It doesn’t require to copy and paste these; this is a process of posting ads, so I’ll have to do them one by one (A through E). I’d eventually want to automate from 1-infinity

Edit: for now, just the address and units so far. I’ll be able to figure the rest (hopefully)

Here is a largely UN-TESTED Macro that should provide an example of how this might be done. You MUST make several changes BEFORE running this macro. See below.

MACRO: Use Excel to Fill Google (or Safari) Form Fields [Example]


Use Excel to Fill Google (or Safari) Form Fields [Example].kmmacros (8.8 KB)


This macro uses KM Actions Google Chrome Form Fields, but should work fine if you just replase the actions with the corresponding Safari Actions.

• I have tested this, but you should confirm
• Just select the Excel rows that contain "Address" and "Unit" columns
• Trigger this macro
• It will copy these cells, and parse into KM Variables:
• zumStreetNumber
• zumStreetName
• zumUnit

Select the Addresses to Process in Excel

and then trigger this macro

• I have NOT test these actions because I don't have access to the web page

  • I have setup one KM Action "Set Chrome Field" for each form field on the page, with the proper KM Variable
  • You will need to CHANGE the "Set field" value to the proper web page forum field.

At the beginning of the process for each address, it will prompt you to confirm.
• At this time you can manually do what is necessary to bring up the form for the next entry.

@BrianJ, if you are able to use this macro, could you please upload your final, finished macro to the Macro Category Section so others can benefit.


How do you add more variables?
Edit: I confirm that this works; in order for me to be functional, I need to add more variables

Hi folks,

First of all, I've been getting great helps from @JMichaelTX. I'm very new to programming and especially to KM and I wouldn't have gotten where I am without him.

With that said, he used this crazy code I can't understand to put and save each data into variables. Check the link here: How Do I Copy and Paste from Excel to Website?

I'm still baffled how to create new variables so I could put more data into it since this was only a portion. I've been noticing my data's columns are off so here's the updated real example: (11.7 KB)

I'm sure I'm not the only one who's been having trouble with making excel to variables, so any information and insights will be very helpful!

Since you did not provide a detailed statement of what variables you want, and which form fields each variable should be set to, I can only offer you this:

The KM Variables are set to RegEx Capture Groups, in the order they are found in this pattern:


Each Capture Group is denoted by a set of parenthesis "(" and ")"
The Capture Group returns the characters matched by the RegEx expression inside of the parenthesis.

To see how this works, and to modify or add more groups, goto and enter the RegEx pattern, and a sample of the data you copy from Excel. Be sure to enter the "m" in the Options box to indicate multiple lines.

In the future, please provide an actual Excel file rather than a CSV file (which can introduce errors).

1 Like

Hey Guys,

I recommend avoiding the clipboard.

AppleScript can directly get the selection in an Excel worksheet as a list of lists.

tell application "Microsoft Excel"
   tell active window
      tell range selection
         set selectionValueList to value
      end tell
   end tell
end tell

You can also get values from a designated range:

tell application "Microsoft Excel"
   tell active sheet of active workbook
      set theValueList to value of range "A2:AB37"
   end tell
end tell

I’m sure you can also get values from a named range, but I’m not going to research that at the moment.



Why? Seems to work perfectly for this use case.
Pulls the data in a form ready for RegEx in KM.

1 Like

Thanks for tmy our input!
I’ve been trying to add the data for the description of the apartments (the long paragraph describes about the apartment), and I’ve been having trouble to put it into a variable (ex. Description). Do you have any clues how to add to variable that’s long string consists any alphabets, numbers?

Also, could you explain me how setting variables work? After this project, I’m planning to copy information on websites (html) to clipboard and set them as variable. I’ve been playing around with it but couldn’t find any “easy” ways to do this.

I really appreciate for your help!!!

Because working with a list of lists will be easier to manage than parsing the data with regex.


I have a similar, but a somewhat different situation. I have a list of names within a single column in Excel. The names are each in individual cells in the form "LNAME, FNAME". I'd like to transfer each consecutive name into an input field in another application.

In the other application, after copying the initial name into the text field, pressing a carriage return (Accept), it will create another input field beneath the first, with the original field scrolling up a bit to accommodate more entries.

In KM I have been able to copy the column of names into the Clipboard in a single list. I am not quite clear as to how to best transfer the names into the other application. Peter had mentioned in another post to assign variables to each of the names in the Clipboard, but I'm not sure how to do that.

Here are a few screenshots of the application:

Thanks for any help.


What is the other app you are entering the data into?
Is it a native Mac app, or a web browser app?

Does it also automatically position the cursor in the new input field?
If not, how to you get to the new input field by keyboard?

How you tried to modify this macro to suit your needs:
MACRO: Use Excel to Fill Google (or Safari) Form Fields [Example]

@lbernstein, did you get your macro to work?