What to write or search on github to get the code for what is written below:

MRAB python at mrabarnett.plus.com
Mon Jan 10 14:21:17 EST 2022


On 2022-01-10 16:39, NArshad wrote:
> 
> Using openpyxl is pretty straightforward:
> 
> 
> from openpyxl import load_workbook
> wb = load_workbook(spreadsheet_path)
> sheet = wb.active
> 
> # Reading the values in cells:
> print('Cell A1 contains', sheet['A1'].value)
> print('Cell A2 contains', sheet['A2'].value)
> print('Cell B1 contains', sheet['B1'].value)
> 
> # Alternatively:
> print('Cell A1 contains', sheet.cell(1, 1).value)
> print('Cell A2 contains', sheet.cell(1, 2).value)
> print('Cell B1 contains', sheet.cell(2, 1).value)
> 
> """
> The cell numbers (A1 or A2 or A3 or A4……… ) are not fixed they can be any. I don't know what the cell number is going to be that's what the problem is.
> 
> The user is going to enter the book name in an HTML form present on a website then it will be checked whether the book user has entered is present or not in the Excel file. If the book is present in the book bank and the user requires that book then one will be issued to the user and the total number of books will be reduced by 1 (one) and the user or borrower’s name will be entered in the Excel’s table row in which the book name is present separated by a comma by other borrower names. The borrower's name can be more than one because more than one copies of the book are there as these are the books that are taught in schools.
> """
>   
[snip]
How are the relevant cells identified in the spreadsheet?

It's often the case that the cells on the first row contain text as 
column labels. If that's what you have in your spreadsheet, then read 
the cells on the first row for the column labels and put them in a dict 
to map from column label to column number.


More information about the Python-list mailing list