-1

So I'm trying to do a subscription comparator based on a google sheets. The g sheets has subscription characteristics in the first row and every other row is a subscription (g sheets so you can see what I mean) I have tried differents method but they didn't suceed with any of them (this one was great but it sent too many request and therefore the API blocked me after 100 request /100 seconds. I also tried to apply the link/unlink method for batching commands but it didn't work either).

Therefore I would need your help. I have very litlle knowledge in python though. I have downloaded pygsheets but really I don't care of what I need to do to suceed.

If you want an example it would be something like that : User typing whatv he want for price, GB of mobile data, etc and it return subscription that match his criterias. Here I am just asking to solve the first part which is to have rows that match criterias; The user enter a criterias problem is not for now.

  • please state exactly what you are looking for (maybe with an example), your question is very unclear. – Nithin Nov 04 '20 at 20:29
  • @Nithin I have edited the post. I hope it's clearer. – TechFan_Theo Nov 05 '20 at 11:53
  • Your question is still unclear to me. Using the data in your sample sheet, give an example of what you want, and where you want it to appear, entering the result by hand if necessary. Eg. what values would a user enter - GB per month, cost, etc? - using real values, and show what results that should produce, and from which sheet. You have lots of sheets, and it isn't clear to me how they should be used to filter your results. – kirkg13 Nov 05 '20 at 15:26
  • Here are two screen record of my PC, one showing what I would like my code to do and the other is an explanation of my Google sheets. https://youtu.be/6yggsn9MXh4 https://youtu.be/ug6JL_TuN3E. If my explantion isn't clear enough, maybe we could do a Discord call or something. That would allow me to better explain to you what I would like my app to do. – TechFan_Theo Nov 06 '20 at 11:50
  • I'm sorry, but people here are normally not willing to watch YouTube videos to learn what your issue is. Your question, and sample sheet, need to contain all of the necessary information, so that this question and answer can also help future people with similar issues. Please see here how to ask a good question: https://stackoverflow.com/help/how-to-ask. And for questions related to Google Sheets, your sample sheet should contain the minimal amount of info required to clearly present the issue, to show what you have tried that hasn't worked, and what you would like the result to look like. – kirkg13 Nov 06 '20 at 13:14
  • I undertsand and I tried to explain it but didn't suceed. – TechFan_Theo Nov 08 '20 at 20:07

1 Answers1

0

I am not sure what you meant by a subscription comparator. Anyway based on your linked quetion, I have updated the accepted answer to reduce api calls.

#list of all values in 4th/price column
prices=wks.get_cols(4) 
#Remove nonnumeric characters from prices
prices=[p.replace('*','') for p in prices[1:]]

#Get indices of rows with price >=50
##i+2 to account for one indexing and removing header row
indices=[i+2 for i,p in enumerate(prices) if float(p)>=50]
#get these rows
rows = wks.get_values_batch([(str(x), None) for x in indices])
Nithin
  • 5,470
  • 37
  • 44
  • I get this error : AttributeError: 'Worksheet' object has no attribute 'get_values_batch' | wks is defined as wks = gc.open_by_url('theurl.com').worksheet(Feuille) .| But I think what the error is refering to is not that. The error is in my undertsnading refering to the Worksheet notion of the API librairy, not the varaible that I created. Maybe get_values_batch doesn't exist ? – TechFan_Theo Nov 08 '20 at 11:59
  • By the way what I meant by subscription what a plan for phone, internet; TV. Here is one plan comparator for example : https://www.whistleout.com/ – TechFan_Theo Nov 08 '20 at 12:01
  • its a new feature please install the staging version. pip install --upgrade https://github.com/nithinmurali/pygsheets/archive/staging.zip – Nithin Nov 08 '20 at 13:40
  • I downloaded the file that you linked. I then export the file into the same directory. I also put the function import worksheet (where the get_values_batch is). I get the same error. Here is my code : https://docs.google.com/document/d/1SGI86HhFIajGnbdaHuMk5BYKfs3O6qt60PdmPhUpLWY/edit (it's a google docs) – TechFan_Theo Nov 08 '20 at 17:45
  • Ohh your are mixing gspread and pygsheets. My answer is only about pygsheets since you tagged pygsheets. Please use only one library. – Nithin Nov 08 '20 at 18:05
  • In my understanding you can't have pyghseets without gpsread but I would look further and reach you out – TechFan_Theo Nov 08 '20 at 20:04
  • How did you came to that conclusion? I am author of pygsheets. Its a separate library. Please checkout docs. – Nithin Nov 10 '20 at 03:35