[Tutor] Help with Excel Workbook and URLs, in Python Charm

Alan Gauld alan.gauld at yahoo.co.uk
Tue May 3 04:36:41 EDT 2022


On 02/05/2022 23:35, Jonathan Torres-Herrera wrote:

> Workbook-A holds a unique identifier, which happens to be a list of email
> addresses.
> 
> On workbook-B, I have a list of URLs, each URL opens a unique online excel
> workbook with information that includes emails as well.
> 
> Here is what I'm asking for help with.
> 
> What would be the best approach to have python take each email address on
> workbook-A, and look it up against the list of URLs in workbook-B, and then
> return which URL it found it on in workbook-A (on a blank column)?

Since network access wull be slow you shoulsd aim to minimise that,
so I'd traverse the list of URLs and build up a local cacche of
the email addresses. Perjhaps a dictionary keyed by email address?

You can then loop over the other spreadsheet and add the corresponding
URL. It's not clear from your description if a single email address
can occur on more than one URL or vice versa. Nor whether thre is a
one to one correspondence - could there be addresses with
no corresponding email or emails with no corresponding URL?
You will need to decide what to do in those cases.

As for reading Excel, there are a couple of third party libraries
that make that easier. Google "excel python reader module"

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list