0

Hey I am python scripting novice, I was wondering if someone could help me understand how I could python, or any convenient scripting language, to cherry pick specific data values (just a few arbitrary columns on the excel sheet), and take the data and input into a web browser like chrome. Just a general idea of how this should function would be extremely helpful, and also if there is an API available that would be great to know.

Any advice is appreciated. Thanks.

2
  • 1. There are libraries for interacting with excel sheets (a simple google search would have revealed that) 2. How do you expect to put data into a web browser? Are you creating a website? Commented Sep 5, 2016 at 14:45
  • This question is extremely broad. Can you write a script to read an excel spreadsheet? If so, show that code? Do you know how to create a dynamic web page using python? If so, show that code. Commented Sep 5, 2016 at 14:55

1 Answer 1

8

Okay. Lets get started.

Getting values out of an excel document

This page is a great place to start as far as reading excel values goes.

Directly from the site:

import pandas as pd

table = pd.read_excel('sales.xlsx',
                  sheetname = 'Month 1',
                  header = 0,
                  index_col = 0,
                  parse_cols = "A, C, G",
                  convert_float = True)

print(table)

Inputting values into browser

Inputting values into the browser can be done quite easily through Selenium which is a python library for controlling browsers via code.

Also directly from the site:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()

How to start your project

Now that you have the building blocks, you can put them together.

Example steps:

  1. Open file, open browser and other initialization stuff you need to do.
  2. Read values from excel document
  3. Send values to browser
  4. Repeat steps 2 & 3 forever
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.