

To enable your gmail to send email using smtp you need to enable 2-factor authentication and a different “app password”įollow this guide to generate app password use any device name. To create a email we will need the following things To send emails python already provide a built-in email, smtplib and ssl library. Now, we have the downloaded file, and recipient email address, lets create an email. This is similar to reading url from excel file read as explained above.

Reading recepients email address from Email You might need to debug depending on the format of response you get. Note: Response from the request url is in binary format which can only be written by opening the file in “wb” mode. #save file with content received from response Code to download file using a url import requests To download file from the url we will be sending a get request to the url and in response receive the file which can be saved or can be used within without saving. Now that we have read the excel file and get the list of urls we ready to download the file from the url. Workbook = openpyxl.load_workbook(url_file)įor row in er_rows(max_row=max_rows): Now we need to read oepn the file and read the cell of which contain the url from where the files will be downloaded. To install xlrd library run command in cmd Leave a comment if you tries using other libraries to read your xlsx file. Alternatively you can use other libraries like pandas, openpyxl, xlsxwrite, xlwt, xlutils, but some doesnot support the xlsx file format so I used openpyxl. To read excel file in python we will use the openpyxl library.
