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

MRAB python at mrabarnett.plus.com
Wed Jan 12 16:39:19 EST 2022


On 2022-01-11 06:31, NArshad wrote:
> -“How are the relevant cells identified in the spreadsheet?”
> The column headings are:
> BOOK_NAME
> BOOK_AUTHOR
> BOOK_ISBN
> TOTAL_COPIES
> COPIES_LEFT
> BORROWER’S_NAME
> ISSUE_DATE
> RETURN_DATE
> 
> 
> -“It's often the case that the cells on the first row contain text as column labels.”
> 
> These I have written above.
> 
> 
> -“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.”
> 
> This written above I do not understand how to code.

Well, you know how to read the contents of a cell, and how to put items 
into a dict (the key will be the cell contents and the value will be the 
column number).

The column numbers will go from 1 to sheet.last_column, although some of 
them might be empty (their value will be None), which you can remove 
from the dict afterwards.


More information about the Python-list mailing list