If you are here to listen to what type of automation i did which i mentioned in my previous blog. then hold on guys , I did not make something so delicious that you would be shocked and feel good about my talent and aim to know as much as i know. If that would be the case , I won’t be writing instead , having vacation outside my country (In fact planet).
My automation was as lame as my jokes, but that led to paying for my auto rickshaw. So here I am sharing how I did all this. As you know I turned my repetitive task into an easy way which directly loads my data to the google sheets by running the query in the backend , so not everyone who even doesn’t know how to write a query can get some sort of data or metric as if it’s prasad.
The steps follows as -
Connect my frontend with the backend of Big Query where i am going to run the pre feeded query just with some difference such as
“ select * from {table} “
The thing in the curly bracket will be changed by the user who is giving the input. For example, if user gives input for table 2 , then the backend will run the query at Big Query as
“ select * table2 ”
And then whatever data the particular query gives , it will first be loaded to the xlsx sheet and then that particular sheet will be uploaded to the user’s google account.
First for all this ,one needs to have an authentication service key from google who owns all the data and is the owner of that project.
After the key — as that key acts as a secret girlfriend which you even hide from your own girlfriend lol.
So the tatparya(conclusion) is to protect the key and not share.
2 things and most important code for my automation was/is -
- The credential which is json form will help to get the data from the bigquery.
The code looks like -
This part of code will help to run the custom sql query in backend
- The other part of code will be this -
- Here , this code will help you into loading you xlsx sheet to the google account, works like a delivery boy helping your food(data) to reach your house(sheet)
- The parent_folder_id , you have to provide outside the function where you can make sure who can have the access to the data , that way you restrict your data to be visible to everyone unless its not your neighbor interested in food .
And that’s how you can do it too, man!
Other than this , you must code by yourself!!! Because confidentiality is the key to food or else the neighbor eats it.
Signing off until my next blog. See ya!
“” Let me know if you have any questions “‘