Reference Excel in Python
Question: I am writing a python code for beam sizing. I have an Excel workbook from AISC
that has all the data of the shapes and other various information on the
cross-sections. I would like to be able to reference data in particular cells
in this Excel workbook in my python code.

For example if the width of rectangle is 2in and stored in cell A1 and the
height is 10in and stored in cell B1 I want to write a code in python that
somehow pulls in cell A1 and B1 and multiply them.

I do not need to export back into excel I just want to make python do all the
work and use excel purely as reference material.

Thank you in advance for all your advice and input!!


Answer: Try `pandas` as well...might be easier to work with than lists in this case

**DATA** :

    
    
    Width   Height
    4           2
    4           4
    1           1
    4           5
    

**Code**

    
    
    import pandas as pd
    
    #read the file
    beam = pd.read_csv('cross_section.csv')         
    
    beam['BeamSize'] = beam['Width']*beam['Height']  #do your calculations
    

**Output** :

    
    
    >>> beam
       Width  Height  BeamSize
    0      4       2         8
    1      4       4        16
    2      1       1         1
    3      4       5        20
    4      2       2         4
    

You can slice and dice the data as you wish. For eg, lets say you want the
fifth beam :

    
    
    >>> beam.ix[4]
    Width       2
    Height      2
    BeamSize    4
    Name: 4, dtype: int64
    

Check this for more info: <http://pandas.pydata.org/pandas-docs/stable/>

You can read directly from excel as well..

