I want to copy and paste values from one website to another, matching the field's names

Hi
I have 2 websites. Both websites are private (need username and password) to access, so let's see if I can explain:

I have a list of names with values in one website:

Ana 15
Pedro 18
Betty 33

then I have another website with a similar list of names, but with empty fields to enter the correct number:

Pedro
Betty
Ana

How can I use KM to copy values from one website and paste them into the correct category on the other website? For example, how can I copy 15 from one website and paste it into the other in the right field (Ana), 18 for Pedro, and 33 for Betty?

I know how to copy and paste values, but I don't know a way to match the categories Ana - Ana, Pedro-Pedro and Betty-Betty, as the order may changes and not the same categories are always present.

Thanks for any help you can provide.

I'm sure there will be good advice here for you, but you may need to outline how you plan to break down the project into separate tasks, and ask specific questions for each stage.

It would probably help to start with if you could confirm what format the lists are in. Are we to assume that they are in plain text (that would be easiest), or is a database involved or..? In other words: how would your macro be able to access these lists? Is the idea for the macro to read the values directly off the site, or do you plan to provide it with plain-text lists offline?

Hi! I was thinking about either copy the full table content with Java or each value? Action below:

And the result would be ( this is an example)


Let's sat I want to copy the age of Tinu 14 and paste it into the field "Tinu" in another website, 28 for Javier, and so on, how can I match the category name and value from one website to paste it into the right category in the other website?

What does the other page look like? Is there a form field for each person? Can you share a screenshot (not of the full page, just that bit), or better yet, the source of that section of the destination page?

-rob.

There are a lot of open questions here, but the direction I would send you is to ask you if the data can be exported into a text file, and then imported back again from a text file into the second website. I would do all the processing external to both websites. In fact, there is a unix command called "join" which seems to do exactly what you want.

I often run into the same problem myself, sometimes with websites but sometimes with Numbers tables. The toughest problem I face with doing that is that sometimes the names aren't identical. For example, in one website the name might be "Washington DC" and in another table the name might be "Washington, D.C." Are you sure there are no naming conflicts?

NAME
join – relational database operator

SYNOPSIS
join [-a file_number | -v file_number] [-e string] [-o list] [-t char]
[-1 field] [-2 field] file1 file2

DESCRIPTION
The join utility performs an “equality join” on the specified files and
writes the result to the standard output. The “join field” is the field
in each file by which the files are compared. The first field in each
line is used by default. There is one line in the output for each pair
of lines in file1 and file2 which have identical join fields. Each
output line consists of the join field, the remaining fields from file1
and then the remaining fields from file2.

 The default field separators are tab and space characters.  In this case,
 multiple tabs and spaces count as a single field separator, and leading
 tabs and spaces are ignored.  The default output field separator is a
 single space character.

No, there's no way to import, and yes there are name conflicts for some categories

The other website, you need to click a link which will open a dialog box that looks like this:

I need to copy each locality amount from a report from the first website and paste it into the right locality on the 2nd website.

Those two issues will make this a difficult problem to solve.

1 Like

Thank you for trying!
For the future, and to learn: The join that you mentioned, is that a KM action?
TY!

I haven't decided yet if I'm giving up. I think I could solve this, but without access to the sites myself, that complicates matters a lot.

The join command is not a KM action, it is a shell command. If you open the terminal application, and then type "man join" you will see its description.

On a humorous issue, the first name in your screenshot, "Barre City" appears to be a spelling mistake for "Barrie City". This illustrates the naming conflict problem that I spoke about earlier.

1 Like

The first website's output looks to be tab-delimited text, so extracting name/value pairs will be easy enough. Is it actually a 3-column format, as in your example?

Putting values into the right places in the second site could be more difficult. Is it actually an HTML form? You might be able to use JavaScript to set the value of the correct element.

Try right-clicking a line -- "Colchester", for example -- and using "Inspect element" (or your browser's equivalent) to view the code. Then you can copy/paste a couple of the form lines here for the JS gurus to examine -- please put them in a "Preformatted text" block!

This will make complete automation impossible -- but I can see a possibility of a macro that first handles all the "unique" names then prompts you through manually choosing which of the duplicates to use for each value. But how are you going to know which of two "Colchester"s to use?