Python - Using gspread and tkinter live search options? - python-2.7

I am writing a program for people to check into a meeting with a graphical interface from tkinter, and I am storing the names and other variables in google spreadsheets using gspread. My questions is whether there is a way to get a live search of the names in the spreadsheet that is populated as a person types. For example, if the spreadsheet has names: Bob, Michael, John, Steve, Sue, Susan and using a text entry box in tkinter, while a person types their name, if they type in S, then Sue, Steve, and Susan appear in some sort of window, and if they type u after S, then the list will only offer Sue and Susan for the person to select their name from. I know gspread has a search for by cell value, but is there anyway to get it to show the results as it searches?

Related

Google Places API gives name of the state as city in the suggestion

We are using google places API to autocomplete state, city or region searches. The issue is when one searches for a state, Places API gives two results one for the state and the other for the city/region. For eg, if we search Maine we get Maine, USA and Maine, ME, USA both in the response. Would anyone please provide a way to avoid this duplication?
Do you use "types" parameter?
https://developers.google.com/maps/documentation/places/web-service/autocomplete#types
"cities" type might give the result you want.

Power BIs Map with Danish post codes

I am trying to add data to a Map with Danish postcodes, e.g. 1000-9000 (we have four digits in Denmark).
When I add that into a Map, it scatters all over the world, as Power BI do not recognize it as Danish locations, even my Power BI is setup in Danish and the Map has Danish spelled city names.
I tried to add the regions Jylland, Fyn, Sjælland as a country hierarchy, but doing that moved Jylland (Jutland) as a place in Norway...
I also tried to use city names instead of post codes, but then a city shows up in Sweden...
It does not change whether the post code format is Text or Number format, and I have no option to use a Location format in the query.
Can anyone help me use Danish post codes for Map visualization? : )
Thanks
Ok, I solved it myself!
I found the place in the modelling part where I could force PowerBI to accept my city names, region names etc. and it now works.
More detailed: go into the middle of the three left side windows called Data (not Report, not Model), and click on the column you want to change format of. Then find the Tools section and change the Data Category to for example Address, or Country etc. Hope that helps

Using Excel IF statement with drop down list

I have a fairly simple problem but can't find a solution:
I have a table with a cell that has a drop down function. The user select from that list and I want the next next cell to also be a drop down list but is dependant upon the data in the first drop down
for example
Cell A2 user selects from:
Leeds
London
Liverpool
In B2 the options are now restricted depending upon the data in A2
E.G - Selecting Leeds, returns second drop down of 1,2,3 or 4
Selecting London returns A, B, C, D
Selecting Liverpool returns Cat, Dog, Rabbit
I was looking to use Vlookup tables with an If Statement such as
=if (A2=Leeds(VLookup, C1:C4,2)
However I am hitting an impasse.
Thanks in advance
You can do this by creating named ranges (Ctrl+F3) with the precise name of the look up, e.g the group Cat, Dog, Rabbit you call Liverpool, then in cell B" in data validation select lists and for the source enter
=indirect(A2)
Please note you cannot use spaces with Named Range names so you can replace with underscores if need be.

Django Spreadsheet Application

I am in the making of a Django application where you will be able to upload an excel spreadsheet file and have it inserted into the application. But I sorta got the importing sorted out.
What I need is a way to store the values dynamically, I basicly need X number of fields for each row, with each three possible types.
These would be:
Boolean
String
Number
How would I go about doing so?
Let's say I have some models that contains this information:
A spreadsheet with a name, and some "header"-cells that will indidate which fields (and their name) that belong to that spreadsheet (but dynamically expanding).
A row that can have multiple cells, each with a type of either a boolean, a string or a number.
An example could be like this:
Spreadsheet 100
name (string)
city (string)
religious? (boolean)
phonenumber (number)
and then I need to pair the cells underneath with the appropiate header, like this:
row
name = "Bob Curious"
city = "New York"
religious = "Yes"
phonenumber = "888 888 888"
I hope that explains it good enough, if not, please go ahead and ask for anything you might like explained.
Thanks in advance! :)
This post is pretty old so I'm not sure whether you still need help with your issue, but I've found xlrd to be an excellent tool for scraping spreadsheet data. I would suggest investigating this package further.
Maybe others would like to hear more about the solution for this question. My plugin django-excel would help with excel data import into and export from one or more django models. What's more, the plugin provides one programming interface to handle data in ods(using odfpy or ezodf), xls(using xlrd), xlsx(using openpyxl) and csv formats. I hope it may help you.

webservice for autosuggest on city names / postal codes including long-lat coordinates?

i'm looking for a webservice, to be used for an autocomplete field,
where people can fill in either a postal code / city name or both
this service will need all cities in Europe, so we can use it for all country websites.
and in a later stadium we want to keep the world open for asia and america so this would be a plus.
preferably it would also return the long-lat coordinates for the locations,
Now it is a free textfield, after leaving the field, we hit the google geocoding service,
to find coordinates... preferably i would tie these two together.
so we don't have to query 2 services for one thing.
does anyone know of the existance of such a service online somewhere?
or would you suggest to build our own database with cities / postal codes / coordinates?
if so we would need to get the content from somewhere too, and i was trying to avoid that issue :)
I recently searched for a similar service, in vain.
I wanted my users to have auto-complete on entering a city name, and once a city is chosen I needed to pass the name and lat/long onto the Google API. In the end I did this: -
downloaded the geonames allcountries.zip, full extract: this
Imported it into a SQL DB via SSIS (about 7.5 million records!)
Wrote a simple query to extract just the cities (only the PPLC, PPLA and PPLA2 records).
This left me with a manageable table of 9112 records (with lat / long and country code) which covers all the cities in the world. I then wrote my own code to query the data.
Not ideal, but I needed a solution.
I know this post is very old but for thouse who are looking for a simple solution that can be integrated in 5 minutes here is the link:
Geocomplete jQuery...
For my case I followed this steps:
1 - Download the plugin from here.
2 - Add the jquery.geocomplete.js or jquery.geocomplete.min.js file into your javascript folder of your project.
3 - Call this file in script tags on the html page where you have the input field that you have to autocomplete with cities:
<script src='/PathToTheFile/jquery.geocomplete.js'></script>
4 - To convert an input into an autocomplete field, simply call the Geocomplete plugin in script tags: <script>
$("#IdOfTheInputField").geocomplete(); // Option 1: Call on element.
$.fn.geocomplete("input"); // Option 2: Pass element as argument.
</script>
5- You can check for the complete list of options on the link provided at the top.
Hope that this helped!