Saturday 7 March 2020

Google Sheet API | Part 1 | Linux Only | Connect And Display Sheet Data ...




Download VENDOR Folder (Only for PHP version 7.2+): https://unpossiblepog.com/research-and-development/php/Vendor-Folder-For-Google-Sheet-Drive-Calendar-With-PHP-Version-7.2-And-Onward

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------
Social Media Links :-

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys, this is UNPOSSIBLE POG.
In this video, I shall tell you how to connect connect xampp PHP with google spreadsheet.
In first part, I shall show you how to display data on browser.
There are few requirements that your should have.
1st is to use linux OS. Most preferable is the operating system from Debian Family.
If you want to know how to install and use PHP in LINUX, then tutorial video’s link is given in description.
Now lets get started, go to google and search google spreasheet api php.
Go inside this link, “developer.google.com"
In latest edition of this link, they improved some steps to make integration easier.
Now it says you require php version more than 5.4.
Go to htdocs location.
Create a new folder.
Change it’s persmission to write inside it.
Open the IDE, and assign the folder in it. I prefer sublime text.
Open it in terminal.
now install composer by using this command.
“sudo apt-get install composer”
As you can see I already installed it.
Go to website and enable your google sheet api credentials.
Download it’s configuration.
Copy-paste it in your new created folder which is in htdocs. in my case its google_sheet.
Now we shall run provided command in folder’s terminal.
It may take more than 1 minute because the command is downloading  composer files from google server which are must to run the API.
Copy paste the code in newly created file.
Make sure to close PHP tag.
Now here, you have to make many changes.
First, remove underscore-readonly text from scope.
Add DIR before those two file locations.
Now, by default, google provided some default spreadsheet link which is common for multiple people but we don’t want that so create a new spreadsheet.
Now copy its id which is after D-slash upto another slash, and paste it in code.
Now each spreadsheet has it’s own name, which is at the left corner.
The name is sheet1, so type it in range variable.
And also column are available from A to C.
Lets first run it in terminal because we are going to create a secret key for security purpose.
Well, I forgot to add slash there.
Lets return it.
Now they provide a link, copy it and paste it in browser’s url.
Login into email ID.
Click on advance then go to quickstart unsafe.
Allow access, and copy paste this code in terminal.
There is another mistake that I have made.
Oh yaa, the sheet name was incorrect. Make sure that you should type sheet’s name before exclaimation sign.
Rerun it.
Umm, the output did come but I think that I was jumping on 5th column but in excel sheet there are only 3 columns so make sure that, you only give column number up to maximum available columns in spreadsheet.
 Now to run this code in browser, just comment those lines and open that page in browser.


Required links are given in the description.
Thanks for watching.
Don’t forget to like, share and subscribe.

No comments:

Post a Comment