Google Sheets and Java
Вставка
- Опубліковано 30 тра 2019
- If you’d like to use the data in your Google Sheets projects from your
Java applications, this is the guide for you.
We’ll use Google’s official v4 API SDK for Java to access an example spreadsheet inside of Google Sheets.
Google’s Quickstart for Java: developers.google.com/sheets/...
More about Batch Update Requests: developers.google.com/sheets/...
Check out Twilio at: twilio.com? - Наука та технологія
Very nice guide - was looking to use google sheets for a java application and just could not understand how to get it to work before this video. I did get some errors with the Jackson json reader in this modern day and age 4 years later, but that was nothing finding Gson couldn;t solve. Thanks for this!
Will it be a big difference if I want to do an android app and read/write data from google sheet? Is it possible to make a video for that case?
Amazing video, I couldn't find any simple to follow guide/documentation since the Google API's are so complex. Very good job sir.
This is great, thank you
Finaly Gradle capable UA-cam tutorial. Cheers!
This was really helpful, thanks)
I used the Google example and no problem but when i try to use my GoogleSheets doesnt work, i changed de String range and the SpreadSheets ID. Whats wrong?? any quick help would be awesome
Can you post a pastebin with the code?
Thank you! It helps alot.
For a long time I can not find a way to write data without duplicates. At the same time, I want to compare duplicates not by all columns, but by certain ones (for example, to compare only by one column). How can I do that? Perhaps you already have such a video or a link to a site with an explanation. Thank you.
What is the test folder for?
is there a way to read google sheet like how you read sql and show the data as table in java?
By any change, is there a way to avoid the consent request?
If we are using java for google sheets that 6 minutes job time out still.implies?
Is there a way to make user choose his own spreadsheet. Fo example if you make the application available in playstor of android , everyone download the application will use same spreadsheet?!
If I want to get values, I have to have "range".
So how to get all rows when I don't knows number of rows or range?
Thanks.
If you know count of columns, just set range ="A:columns count"
For example range = "A:K"
Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.Object com.google.api.client.json.JsonFactory.fromReader(java.io.Reader, java.lang.Class)'
Why this error
What changes should be made If I'm using it for an Android app java?
If i run this code at server side, how can i give the permission to sheet at first time.
Doesn't seem like a true CRUD since you manually created the google sheet to read, update, and delete. Is it possible to programatically create a Google Sheet? I have been looking all over and in the Google Dev documentation would appreciate any help.
I believe you could create the sheet using the Google Drive API.
Hi, I'm getting GoogleJsonResponseException: 403 Forbidden error while writing values into cells with message: "Request had insufficient authentication scopes." and status: "PERMISSION_DENIED". Do you have any idea what causes this error?
try deleting the token you generated if you ran it originally as SPREADSHEET_READONLY and rerunning the code
How do I go about updating a row`s data based on an ID i placed in one of the row`s cells?
The easiest way is probably to use batchGetByDataFilter and then do an update on the resulting row: developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchGetByDataFilter
Thank you so much sir!!!!!!!!!!!!!
You’re welcome!
the quickstart for java site doesn't seem to work the same way anymore so i've been on the first minute of this video for 2 hours, my head hurts, i'm tired, i don't understand any of it, i wanna cry
Thanks...please make a video on how to get value with query in google sheets using java.
Can you please teach me how to get data on a specific column only?
the code name at 2:48, pathname at 3:43 and set access type at 3:47 throws an error saying it can't be resolved, anyone know how to fix this / let me know what I did wrong?
Did you solve that?
Did The error rectified
Hello, I have got a problem. Now google offers another way of getting credentials.json. On that webpage I don't see this stuff which you got. Can you please tell me where should I install credentials.json?
what if I don't want anyone with the link to edit my sheet&
How can I get this code?🙄
Do we need any subscription to access Google sheets API ?
Will this work as a springboot web app?
It is OK. But you copy google oauth link from console. I want to use with spring boot rest web service. How can I do without an extra login page? Is it possible?
the console give me this error "because you are running on a non-POSIX file system" what can i do? thanks
hey, i have the same error. Have you fixed it?
@@user-wy7bv3iw2h hey, that error is not a problem. My program works very Nice with that error. But if you want to know about posix file sYSTEMS Google it, there are much information about that.
its not error. This is WARNING!
@@OwnedTime “but if you want to know about posix file systems google it” i said. For me still working just fine.
Can it be done using maven ?
can you please provide more info about how you can get credentials and what exactly was specified at console developer?
0:48
@@piotrkrajewski17 it changed btw
Can we do it without making the project a gradle project?? I am getting error "java.lang.ClassNotFoundException: org.mortbay.component.LifeCycle"
@@twilio I asked it regarding the code that is explained in the video. I think I have been provided with a wrong link.
@@1992supergamefreak Oh yes sorry you are correct. I thought you were missing the Twilio library but we don't use that in this video :) The full installation instructions (including the zip files for Google's Java SDK) are here: developers.google.com/api-client-library/java/google-api-java-client/setup
How can I authenticate like you did at 6:28 from within a docker container, im very curious
I think you should be able to. The example we’re showing shows how to do this with a document but you can also pass the values in directly.
@@twilio do you have any recommendations on what I should Google for, I couldnt find anything in Google sheets docs
I am unable to load creadentials.json in resources
Getting this exception. I have also tried deleting and re-generating the credentials.json file.
Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden {
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "Insufficient Permission",
"reason" : "insufficientPermissions"
} ],
"message" : "Request had insufficient authentication scopes.",
"status" : "PERMISSION_DENIED"
}
Were you able to resolve this?
I was able to resolve it, I changed the sheets status from 'anyone with link can read' to 'write'. Then I went in and changed this line .setDataStoreFactory(new FileDataStoreFactory(new java.io.File("tokens"))) from tokens to 'token' to generate a new token
Okay, I will try this one.
can you please share the code please?
When creating input stream for CREDENTIALS_FILE_PATH better to use try with resources
got error
Execution failed for task ':SheetsAndJava.main()'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
can someone help? Im good at painting, not coding
It basically means that it failed, literally. You need to use the stack trace to get the actual errors, cause from that 1 message alone, it can be literally anything.
Please make one for Google Sheets and JavaScript.
We made one already :) ua-cam.com/video/UGN6EUi4Yio/v-deo.html
@@twilio Thank you so much. Loved it.
Awesome! Let us know if there’s anything else you’d like to see.
@@twilio Please make one for Google Sheets and Apex Salesforce
I got the error "Execution failed for task ':SheetsAndJava.main()'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1"
can someone help?
You need to find the error code to get a hint on what caused the execution to fail. For example if the error code is 400, then it means the server (google) cant understand your request (for the sheet) that you sent, a common mistake is your range value (in this case "congress!A2:F10"), there might be a typo. If its not then you will have to debug and look for your error
Is there a way to do the same in Maven?
Yes very similar just import com.google.api.client as groupid and google-api-client as artifact id and same for the rest of the imports in your pom
0:41 you did not explain what is this. I don't understand what is Java quick start .
nice
We want to more videos about api service
After breaking my head for 20minutes why the hell can't I run the read on my own file, I figured it out,
When you do the read (not sure when they changed it) you don't need the file name when you specify a range.
Bro.... U a fucking g lad. i love you
please give me git repo
Comparing to Apache POI the google sheet API looks really ugly
everything's great except Dark theme, can't see nothing
as a beginner, I still didn't get it :(
WARNING: the authentication part in this video is obsolete
what do you mean?
how to i refresh credentials
for me InputStream in = SheetsAndJava.class.getResourceAsStream("path/to/file");
didn't work for some reason I got null pointer exception all the time.
I used FileInputStream in = new FileInputStream("path/to/file"); instead, now everything works fine