Complete newbie, that simply hasn't a clue needs pointing in the right direction

Apologies, I am an UTTER beginner and not sure where to go for help.
I have an excel workbook.
Sheet 3 Column B contains the data I’m interested in. It can have up to 2000 rows of entries.
I need to copy, individually, each cell in column B, go to a website and paste the data into a box and then hit a button.
This returns a specific value that I then need to copy and paste in to column C on the excel spreadsheet.
I know this is something to do with openpyxl and pandas but that’s as far as I’ve got.
I’m assuming what I want to do is possible in python?

thanks

You’ll need some Python fundamentals, such as (for example) if we have a code line wb = load_workbook(filename=file) followed by sheet_names = wb.sheetnames that we now have a list object that holds the names of the worksheets of the file with which we are working and how that kind of object can be used.

Is that something that you comprehend?

1 Like

Hi Rob,

Thank you for replying.
My afternoon took me deep down the rabbit hole and I’ve discovered I need to use selenium webdrivers.

Unfortunately company IT policy blocks these from use. (Because the company can’t be seen doing anything to make life easier for staff you know!)

So it’s a bust for now I’m afraid

You are very welcome Alan.

What you asked to do is in fact not a big job, in and of itself (the Web interface aside). The issue would be that if I simply gave you a generic script, it would only be good for one thing, whereas if you knew a little Python, you could adapt said script for more general use.

1 Like

My Python educations begins on Monday at Strathclyde Uni.
I appreciate the fact you’ve even taken time to read my post, let alone reply twice.

Thank you very much

1 Like

My afternoon took me deep down the rabbit hole and I’ve discovered I
need to use selenium webdrivers.

That is unfortunate. Is it really the case though?

You can extract the Excel data with openpyxl or pandas. I believe you
can write an updated sheet with openpyxl.

go to a website and paste the data into a box and then hit a button.
This returns a specific value that I then need to copy and paste

IIRC the selenium stuff basicly runs a web browser to do interactive web
based things. But lurking behind most web things are form URLs which
you can call directly; the usual Python library for that is “requests”.

If you can find the underlying web call and there’s no complicated web
browser side state required, you should just be able to do a GET or POST
request to obtain your data, which you can then put back into the
spreadsheet.

Cheers,
Cameron Simpson cs@cskk.id.au

Ok, food for thought.
Thanks.

Here are the 4 main values

<input type="radio" name="deoren" value="decrypt">
<input name="string" type="text" onfocus="javascript:this.value=''">
<input value="Go" type="button" onclick="JavaScript:xmlhttpPost()">
document.querySelector("#result")

Gotta love a text field which self erases whenever you give it focus :slight_smile:

There should be some surrounding <form> tags controlling where the
xmlhttpPost() sends its stuff. My JS is weak but in principle the form
defines everything that is sent, and the xmlhttpPost says how it
should be sent (some XML format, probably quite standard).

You could replicate that, maybe using a command line tool like wget or
curl, and see what you get back. When you understand the form, write
Python requests calls to do the same thing (requests.post, based on
the JS above).

Then you should have the core web call, and won’t need selenium etc.

Some things can’t be done this way easily, but IMO most things are just
overengineered JS UI fluff around a basic form.

Cheers,
Cameron Simpson cs@cskk.id.au