I have a list of (keywords) stored in a Column in an Excel Sheet, I want to open each keyword in different chrome tabs(multiple tabs) at once. Can anyone please help me with a python code to automate it?
P.S. I am not technically sound but want to automate the process to increase my work efficiency.
Rahil, say your keywords are in the "A" column of rahils_keywords.xlsx
file, in the worksheet called keywords
. At the shell, install this dependency:
> pip install openpyxl
Then in your text editor or Python REPL:
import webbrowser
from openpyxl import load_workbook
def google_search_keywords_from_spreadsheet(path: str, sheet: str, column: str):
wb = load_workbook(filename=path)
worksheet = wb[sheet]
num_rows = worksheet.max_row
for row_num in range(num_rows):
cell = f"{column}{row_num + 1}"
keyword = worksheet[cell].value
if keyword: # skip blank cells
url = f"https://google.com/search?q={keyword}"
print(f'searching for keyword "{keyword}"...')
webbrowser.open(url)
google_search_keywords_from_spreadsheet(
path="rahils_keywords.xlsx",
sheet="keywords",
column="A",
)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments