Edit a cell only with Script - javascript

I'm trying to eliminate user error in order to make my sheet sustainable from a maintenance perspective. I built a Google Sheet that is a task tracker which logs which user checked off a task. How do I lock a cell so that it may be edited ONLY by the script (the Effective User (me)), and not by manually inputting data (NOT by the Active User). If someone inputs data into a cell, it becomes not empty, and the log is shifted or otherwise corrupted. I've tried locking the sheet/cells, but then the active user can't log ANY information, even though they're using the script to log it. How can I lock a cell so that it may be edited by the effective user but not the active user?
SEE ATTACHED EXAMPLE:
Column A may be edited by User, which prompts script to fill in columns D and E.
Columns D and E should ONLY be edited by the script; no user should be able to type into those columns.
Columns B and C may not be edited by User, as they must remain the same always.
Help!
Thanks :)

Given that desire of control, I'd suggest the best solution would be a web app limiting input to the specified fields (perhaps using a dhtmlxgrid)

Related

Bluebeam Scripting - Custom Columns, Markups, & Forms

BLUEBEAM AND ADOBE ARE BOTH PDF VIEWERS THAT HAVE A LOT OF SIMILARITIES
Hello, I am trying to figure out how to link a form answer to some markups (tools).
Custom Columns that are created In Bluebeam:
When I create a new tool I can manually fill out all of these custom columns under the "Custom" section within the settings of a tool:
Then I can save that tool and all of the data will be repeated for every copy of that tool. However, the circled columns in the first picture would be changing on every page. Which means I would have to make a new tool for every page. (FYI I would be making ~20 tools for this, so I would have to update 20 tools every single page ;_;) Therefore, I want to create a dropdown/textbox on each page with those columns. When a user fills out the dropdown/textbox, the markups are automatically updated with that info, which means the custom columns are also updated.
Does anyone have an idea of how to link these?
As of now I have been able to create a code that creates a popup if a user selects a certain drop down. This shows me that you can grab the data from a user. I just don't know how to connect that data to all the markups (tools). I know each markup has a special ID, but I'm curious if you can somehow link to the tools "subject" property to do this.
Bluebeam provided me with their JavaScript API if that is any help.
https://i.stack.imgur.com/yEdU1.jpg (I got this image from this post JavaScript Library with Bluebeam)
UPDATE
I found another document with potential accepted scripts for Bluebeam. Please note this one will require people to have Bluebeam Revu eXtreme
https://support.bluebeam.com/wp-content/uploads/2019/08/Bluebeam-Script-Reference-2018.pdf
This version actually has a markup section (which are the things I am more or less wanting to have the custom columns be updated for with the user input)
This document seems to be relevant only for the Bluebeam Script Editor. You can open it by looking in the folder for Bluebeam from your start window.
There are 2 issues I have with this though. I haven't figured out how to run the codes I have in the script inside of Bluebeam yet and I am curious if there is a way to not need the markupID's and/or a way to get them without having to download the markups
I've been lurking on stack for so long, I finally have something to contribute...
I work with custom columns and toolsets all the time. I think you're missing a basic understanding of what the markup list is. Or maybe I am. The markup list is the table of data at the bottom of Bluebeam, where you're trying to change column headings.
The markup list is basically a table of data, what you're trying to do will change the column headers per page, which would change it for all entries. From what I know about Bluebeam, these are static, just like any database or table in any application like Excel. If you need to have different column headings, you need to just stack them all and use what you need on each page or from tool to tool. Or create different profiles with different custom columns, but this gets messy having multiple profiles accessing a single document. Maybe java can help show and hide these per what's relevant on the page within the custom field. But... I think the java is limited to be used within PDF form fields and some basic PDF actions such as print, save, etc. I don't think the level of coding you're looking for exists within Bluebeam.
I use profiles to manage custom columns per process, not the actual tool. It's kind of unclear exactly why the custom columns can follow the tools without the actual profile though.
What I do to accomplish complex tasks is export the markup list and build something within Excel VBA to tabulate data and export reports with relevant information. I'm sure you could use basically any coding language to accomplish this after the table is exported from Bluebeam.

Google sheet script to assign action items (Ctrl+Alt+M)

I am trying to automate action items assignments in google sheets.
At the moment it is manual process. Our google sheets have section with two columns:
One column with reviewer names and emails
Another column with sign off (completion) dates
Managers have to go through many “sign off” cells one by one, press Ctrl+Alt+M to insert comment, enter corresponding reviewer’s email with plus symbol and some text
‘+John.Citizen#mycompany.com
Please review this sheet and blah-blah-blah’
JavaScript Range functions setNote or setCommet (https://developers.google.com/apps-script/reference/spreadsheet/range#setnotenote ) do not work for me.
Any idea how to assign using script or somehow simulate pressing (Ctrl+Alt+M) ?
Thank you
As #Patrick P says, there is no methods in Apps Script to interact with comments.
But go ahead and add a star next to the issue number here[1] to give it more visibility.
[1]https://issuetracker.google.com/36756650
With the Drive API you can create and manage comments and replies, they can be anchored to a position on the document, or unanchored which is just associated with the document.
Have a read at the documentation here:[2]
[2]https://developers.google.com/drive/api/v3/manage-comments

I am trying to do Element Control, Redirection and Form Submission Processing with WIX Code but I am unable to find a suitable method

I'm kind of a beginner to WIX Code. I have this site which I have made i.e www.rat-store.com. I am facing three problems which I know might get solved with some code but I don't know how to do it. Here are the problems:
In manual payment, I need to accept some form input from the user on a page and only if the user agrees to the terms and enters the correct date should the submit button get activated following which an otherwise collapsed image should also reveal (it's the QR code to make payment; Image 1) (www.rat-store.com/manual-pay-rat)
Image 1
I'm trying to link a repeater background to a page but it's not working. I have to create a button inside the repeater to do this. Any workarounds? I know an image will work but the thing is that the motive is to create a kind of a list which will keep on incrementing in the future and I can't just keep on drag-dropping images, text and then group them up and link. (Image 2) (www.rat-store.com/shop-by-events)
Image 2
Since WIX Stores doesn't have an inbuilt cancellation feature I built a form to substitute for the same but I want that no two same order cancellations are submitted i.e. a customer can only submit his/her cancellation request for a particular order number once. The next time s/he tries to do that it should show that the request already exists. (Image 3 and Image 4) (www.rat-store.com/cancel-orders)
Image 3
Image 4
Some help with the code and approach would really be great. I'm almost finished with my site; Only these last few things bother me. I'm attaching a screenshot of each page, serially w.r.t the question number. P.S: The order number is the number generated for each order by the Wix store app itself. I have nothing to do with that. The customer needs to enter his/her number and if that is valid we will process the request. Apologies for the length of the post.

How to open a spreadsheet at specific cell/row with an URL

I would like to have an URL which opens an editable Google Spreadsheet and have specified cells selected so that the user does not have to find the data in a long sheet before editing. The cells to be selected should be given in the URL. It is also good if a specific row is filtered.
It was super easy with the old Google spreadsheets. I know it is possible without editing possibility, but I need it to open the editable version.
Also I know that I could create a filter view and share that as a link, but I cannot make a filter view for each row and get the URL for it.
I have also went into web scripts (HTTP Get in Google Spreadsheet, "e undefined"), which can take variables from URL, but cannot open the sheet on the client side (I have not found it yet).
You can create a Google Script webapp that would store url values as User Properties which could then be used in an onOpen trigger. To make this work there is a couple of things to be aware of. Firstly, like other Properties Services stored values are bound to the script. This means that if you write two different scripts and set a User Property in one script you can’t get it in another:
The Properties Service lets you store simple data in key-value pairs
scoped to one script, one user of a script, or one document in which
an add-on is used. … Properties are never shared between scripts. –
Google Script Properties Service Guide
A way around this is you have a library which is used to store and return properties. I've written a blog post which explains this in more detail. As part if this I've created a webapp anyone can use using the following url and parameters
To open your sheet at a row for editing direct users to the following url replacing the values as indicated:
https://script.google.com/macros/s/AKfycbzG9_2mWd6x7zFf9V6PH33ORRzZWcVGi_pQs500nbs5Pbdkwy26/exec?id=YOUR_SHEET_ID&sheet=YOUR_SHEET_NAME&row=YOUR_ROW_NUMBER
Optionally if you wish to include a header row when the sheet opens use &header=NUMBER_OF_ROWS_FOR_HEADER. Anyone is welcome fork/modify this code to get your required functionality.
its not possible in new sheets because they removed the listview feature from old sheets.
your only option is the one mentioned in the linked blog post you provided:
"Comment at a specific cell, and, in that comment "plus someone" - that is, type "+" and then the person's email or name NOTE: you will get a list of people in your domain as soon as you type the "+", filtered as you start typing their name/email the person you "plussed" will get an email with both the contents of the cell and your comment the link in that email will take them DIRECTLY TO THE TARGET CELL with the comment activated"
*** Update THR 20181004: In today's current version of Google Sheets, you can right-click a cell and select the "Get link to this cell" menu item, which copies a URL to the clipboard that will open the spreadsheet with the indicated cell in the upper left corner, subject to the limit of the existing rows and columns filling to the bottom and right edges respectively of the page. The URL is the same format as in the previous feature before this exposure in the Sheets UI, appending &range=<cell-A1-address> to the #gid=<tab-GID> fragment spec, eg:
https://docs.google.com/spreadsheets/d/1QSAJzpdM6z4haa-ah1HKqdy8U1vUxWmPIwplej-9fsI/edit#gid=907876553&range=C7
In today's (THR 20180607) current version of Google Sheets, you can open a sheet with a specified cell shown in the top left visible corner, by specifying the cell address as the range in the URL's fragment component. For example, cell C7 in Google's [Template] Google Sheets: Project plan sheet:
https://docs.google.com/spreadsheets/d/1QSAJzpdM6z4haa-ah1HKqdy8U1vUxWmPIwplej-9fsI/edit#gid=907876553&range=C7
Of course this same technique positions the top left cell of a multicell range in the top left visible corner of the sheet.
Note that the specified cell will be positioned in the window's scrolling viewport after any frozen rows/columns are applied to the view. You can get the complete URL, including the cell's fragment tuple, by right-clicking the cell, and in the popup context menu selecting "Get link to this cell".
The URL can be constructed programmatically, so any object in the sheet that can anchor a hyperlink URL can be linked to any cell/range for navigation to it. Therefore this technique is usable via the GUI, by cell formula/style, or by script - or by any external application/page.
It's disappointing that Google hasn't included in the basic Sheets GUI a field in which the user can enter a cell or range address to jump to that range by URL. Every serious spreadsheet application has had this basic feature since the 1980s.

What is the best way to modify a specific field in a form?

Specifically what I'd like to do is "alter" one of the fields in the Google Calendar field entry for my own purposes. Namely the location is almost always going to be one of four locations, but the way the Google Calendar is set up it doesn't track frequently entered information, and writing the full address every time (or keeping a notefile w/ the 4 addresses to C&P) is kind of annoying.
Ideal I suppose would be an "extension" or script that would automagically detect that I'm filling out a Google Calendar event entry and change the location field to a drop with the four addresses I frequently use as well as an "other" option.
Another possibility might be some kind of bookmarklet (or set of 4) that fills the location field in.
I don't really know where to start or which method would be better (hell, there might well be a third option that is superior).
PS: If this would be easier/more efficiently done in Firefox or some other browser rather than Chrome that is fine as well.
I'd go with bookmarklets. Here's a potential URL for setting addresses given the current Google Calendar page (the id of the "Where" input is ":1u"):
javascript:document.getElementById(':1u').value='123 Some st.'; void(0);
I'd write bookmarks with URLs similar to the above for each of your 4 addresses and then put them into an easily accessible folder, and use them each time you want to populate that address.
UPDATE:
Since the ID changes, you can get it by the class name. However, if the class changes or the number of inputs before the Where field changes, you'll have to update your links:
javascript:document.getElementsByClassName('textinput')[1].value='123 Some st.'; void(0);
UPDATE 2:
Apparently Google doesn't consider the current value of the textbox when a Calendar item is saved. I fixed this by manually firing the 'change' event after the value of the textbox is updated. The following currently works in Firefox:
javascript:var a=document.getElementsByClassName('textinput')[1];a.value='123 Some st.';var e=document.createEvent("HTMLEvents");e.initEvent('change',true,true);a.dispatchEvent(e);void(0);

Categories