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

Dennis Lee Bieber wlfraed at ix.netcom.com
Thu Jan 13 15:22:50 EST 2022


On Thu, 13 Jan 2022 10:44:01 -0800 (PST), NArshad <narshad.380 at gmail.com>
declaimed the following:

	Please arrange to use some client that does proper quote attribution.
It gets difficult to read these when you have snippets from multiple posts
with no attribution of who wrote the snippet, and when it was posted, etc.

>
>- “if you are deploying to something like Heroku for the application -- the Excel file will have to be deployed also, and no one except your application will be able to see it there. Under this situation, there is no reason/excuse to keep the data in the very inefficient format you've defined in the most recent message. Import
into some supported database and normalize the data to make updates easier.”
>
>Ok with deploying the Excel file also. Next time I will switch to another database.
>

	There is still that lingering question of who can see the data. Once
deployed, the only way to access that Excel file will be either by the
owner of the Heroku instance (you -- using the deployment process; FTP? I
presume if you can upload, you'll be able to download) or via your
application. 

	As you've described this system, the only thing your application will
do is record "check-outs" by tracking available copies of books, and the
name (and dates?) of the person doing the check-out. There is no reporting
function -- not even a print-out for the user of which books they've just
reserved, so how does anyone actually verify they are to receive a physical
book after reserving it. Is there any logic to prevent someone from
reserving multiple copies of a book... You'll also need logic to ensure
that multiple borrowers connecting to the application at the same time
can't both reserve the same copy of any book, or that one borrower doesn't
block others from reserving other books at the same time. Spreadsheets are
not "multiple user" files, and if each session (borrower connecting to the
application) results in the application trying to open the spreadsheet
you'll have conflicts.


>
>
>-“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).”
>
>No, I don’t know. I tried but still the same.
>

	Tried what?

	All throughout this thread you have never shown us a sample of code
you've written. When asking for help about a Python feature, It is common
courtesy to provide a minimal complete example (ie, something that readers
can cut&paste into their environment to test) that reproduces whatever
problem one is having.

	Other posters have provided snippets of how to read from an Excel file.

	If you don't know how to put stuff into a dictionary ("dict") structure
you need to step back from this application and study a Python tutorial as
dicts, lists, tuples are core data structures available in the language
(whereas in my ancient days, we'd have had to learn how to code a
dictionary from scratch -- look up "hashed head multiply linked list"
someday <G>)



>
>
>-“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 afterward.”
>
>No need to do with the whole spreadsheet only the first column is enough

	Really? Per your earlier post

-=-=-=-
On Mon, 10 Jan 2022 22:31:00 -0800 (PST), NArshad <narshad.380 at gmail.com>
declaimed the following:

>The column headings are:
>BOOK_NAME
>BOOK_AUTHOR
>BOOK_ISBN
>TOTAL_COPIES
>COPIES_LEFT
>BORROWER’S_NAME
>ISSUE_DATE
>RETURN_DATE
>
-=-=-=-

... the first column is just "book names"... Don't you need to access the
various copy count columns along with borrower names (and dates)?

	The purpose of the dictionary is to map your column headings to the
actual spreadsheet access (either "A".."<whatever>" letters, or numeric
1..<whatever> indices). That way, later in the code, instead of having to
keep track of cryptic column IDs ("I need the 'copies_left' column -- is
that column 5 or 6?") you'd use, say, column_dict["COPIES_LEFT"] where the
dictionary has something like
			{	..., "COPIES_LEFT" : 5, 	...	}



-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/


More information about the Python-list mailing list