The spreadsheet holds events and my code has a linked list of these events organized by date.
However my code only reads the spreadsheet once.
So if the spreadsheet is every changed (added a row, deleted a row) my code doesn't know.
I'd like my spreadsheet to somehow notify my code that a change has been made.
Else I guess the other option is to check for any changes once a day with something like a while loop.
Thanks!
There are 4 events as mentioned in official documentation on Google Developers Site, as follows
onOpen()
onEdit()
onChange()
onFormSubmit()
Update: These events are written in Google App Script and not in Java.
Related
I am trying to listen to my document using the Snapshot Listener method in Android.
I have a document called 'Mobile' and a field called 'UUID'. In 'UUID', I keep all the UUID's of the phones the person has logged into.
The problem with this code is that I am not able to get listeners continuously with this code. Can we use Android Services or something to continuously check for changes in the document or a field in the document.
I need to create a code which will be continuously checking the UUID field for any changes and the code should create a Toast accordingly.
I am also worried that this will kind of increase the number of read/writes for our database.
Can someone please help me? Thanks in Advance
The problem with this code is that I am not able to get listeners continuously with this code.
Why would you say that? This is what it does, it gets the data in real-time.
Can we use Android Services or something to continuously check for changes in the document or a field in the document.
If you want to get updates even if the user closes the app, indeed you need a service. For more info, please check my answer from the following post:
How to create firebase background service in Android?
I am also worried that this will kind of increase the number of reads/writes for our database.
Yes, it will increase for sure the number of reads/writes if you continue to keep the listener active. So for not paying extra reads/writes, you should remove the listener according to the life-cycle of your activity as explained in my answer from the following post:
How to set addSnapshotListener and remove in populateViewHolder in RecyclerView Item?
I've been facing an issue within adding a new sheet (tab) to existing spreadsheet.
Before the main issue, I will try to explain why I need to do such a thing and maybe there will be other solution. I'm trying to upload spreadsheet with several sheets. When sheets have smaller size, everything is ok. But when I do the "service.spreadsheets().create(spreadsheet).execute()" request with really big sheets (like two sheets with 40k cells), I get normal response, but created spreadsheet contains only empty "Untitled document" with empty tab. That's first thing which bothers me, why I don't receive something like "your insert is too big" or something like that.
So I would like to create spreadsheet, insert first tab (as a smaller request) and then add another tab (sheet) and so.. But what I only found over the stack and google documentation is "BatchUpdateSpreadsheetRequest". But this request doesn't allow me to add already created sheet, it just create new empty sheet, which is really annoying.
Do I miss some API call? Also I found over the documentation and stack some limits, but there is no clear info about how big can be requests with sheets (I've seen all the 400k rows, and what you can found here), but that didn't help a lot.
Can someone provide me info how to "split" spreadsheet creation into creating more smaller request so the created spreadsheet will contain all the data?
Thanks
The V4 API currently has a limit of 10MB of data per request, though I don't think we advertise this fact in the documentation anywhere right now.
To workaround, you can use multiple different requests in a BatchUpdateSpreadsheetRequest -- an AddSheetRequest as you mentioned, plus UpdateCellsRequest, or some number of other requests. Check out the guide that details what requests deal with what portions of the spreadsheet.
If you have specific portions of the spreadsheet you're curious about how to set, please follow up.
I was wondering to create something like a setup wizard for when the user first starts my app. This is needed due to the complexity of the app to help the user. Searching for something like this I found a library that isn't a setup wizard, but lets you point an element on the screen and give some info about it.
The library is this link. (Showcase View Library by Espin)
I'm able to show one indication using this, but I can't concatenate more than one indication, you know, the first is shown, you pulse next and goes to the nex indication, this way until you arrive to the end and pulse finish.
Looking for any tutorial or step-by-step guide that could help me doing this, I found one, but it was done with old code, and the newest version of the library has some changes that doesn't fit the example. I've tried modifiying the code of this example to match with the new version of the library, but I don't get to view the indication one by one, I just get all them overlapped.
This is the link to the library's ShowcaseView class where all this logic is defined: ShowcaseView.java
And this is how the doc says to implement it ot your app:
new ShowcaseView.Builder(this)
.setTarget(new ActionViewTarget(this, ActionViewTarget.Type.HOME))
.setContentTitle("ShowcaseView")
.setContentText("This is highlighting the Home button")
.hideOnTouchOutside()
.build();
Has someone worked with this library and knows how could I concatenate few indications?
What's missing in v5
ShowcaseViews: the class which queues up ShowcaseViews in a
tutorial-type method. I never really liked this class (generally, you
should use SCV sparingly); I'll add it back in based on the Builder
class when I can.
So either:
implement it by yourself and submit a pull request.
Or wait for the next release.
Or use v4
Or submit an issue on github to directly ask the author when this will be released.
Is it possible to programmatically protect a worksheet in a spreadsheet to only allow specific people to edit it?
I can't find any decent documentation or examples on how to do this. The only things I can find that may be relevant are the setRights()/getRights() and getContributors() methods in BaseEntry.java, which I don't think are any good, but I don't know because there's no documentation.
Is there are feed URL I can post to to update the list of contributors?
Thanks for any help.
Google-apps-script
Looks to be possible with Google-apps-script
https://developers.google.com/apps-script/reference/spreadsheet/sheet#setSheetProtection(PageProtection)
Gdata - spreadsheet api
there is nothing close to that in the spreadsheet api. Even basics
like set cell color or insert row don't exist. (there an append row)
It works fine for data and calculation but little else.
Im new to java and working on a simple application that monitor an url and notify me when a table is updated whit new items. Looking at the entire page will not work as there are commercials that change all the time and they would give false positives.
My thought was to fetch the url line by line looking for the elements. For each element I will check to see if the element is already in an arraylist. If not the element is added to the arraylist and a notification is send.
What I need support with is not the exact code but advice if this would be a good approach and if I should store the elements in an array list or if I should use a file instead as there are 2 lines of text in each element.
Also It would be good to get recomandation on what methods and libs there would be good to look at.
Thanks in advance
Sebastian
To check the site it'd probably be more stable to parse the HTML and work with an object representation of the DOM. I've never had to do this but in a question regarding how to do this another user suggested using JTidy, maybe you could have a look at that.
As for storing the information (what you currently do in your ArrayList): this really depends on what you use your application for. If you only want to be notified of changes that occur during the runtime of your program this is perfectly fine. If you want to have the information persist you should find a way to store the information in the file system or database.