Google app script to update data in row 2 (a named range) of a spreadsheet - named-ranges

i've created a script to mass produce copies of a Google Sheet from a master sheet. The script changes the name of the documents according to data in a separate sheet.
Within the template sheet, I've set row 2 as a "named range" and what i'd like the script to do is to also change the data in that row based on data I have in the master sheet.
I have been previously advised that this is possible but I confess I have no clue how to code this in to my script!
Is anyone able to offer any code which might do the job?
Many thanks
Kerry

Related

Smartsheet-api, Is there any way to get manually deleted row using smartsheet api or sdk call

I am deleting row from a sheet, On a sheet I have daily job which needs to recognize the deleted records, I need a way to recognize them using smartsheet api or sdk..
Thanks in advance..
I don't believe this scenario (identifying deleted rows) is explicitly supported by the API at this time. Seems like you could still use the API to achieve your goal though, with a bit more work (code) on your part.
Your code would have to get the sheet data (i.e., all sheet rows) at a regular interval and save that data somewhere -- then each time job runs, get the sheet data again and compare that data to the data you saved the previous time the job ran (to identify any rows that had been deleted).
Edit 9/26: Added Webhooks info
Note that with the approach I've described above, any rows that had been added AND deleted during the interval between job runs would not be detected. If it's important to identify each and every time a row is deleted, a better (and much more efficient) approach would be to use Webhooks. By using webhooks, your application subscribes to notifications for a specified sheet, and then would receive a callback (HTTP POST) from Smartsheet any time the sheet changes. Your application would need to inspect the information in each callback it receives to identify 'deleted row' events (eventType = deleted and objectType = row).
A simple way to do this is to add a column with a checkmark named "delete" or something similar, then with automation you can move the row to another sheet when the flag is detected, the row will be removed from the original sheet, but you will have a record of the deleted row in a different sheet that you can read or do what ever you need to do, this will also prevent deletions by mistake and you can even restore the row back if you need to. I don't think you need much code to implement this solution.

Tableau - How to replace data source for only one sheet

I am pulling data for a couple brands into google sheets with zapier. I am pulling information from each sheet as a separate data source in tableau. The formatting across the sheets is uniform, only values are different.
My objective is to use a completed viz sheet as a template, so that I can duplicate the sheet, and replace the data source. However I am running into a problem.
Generally when replacing a data source with "replace data source" the changes occur on a project wide level, but I need the changes to occur on a sheet level.
Is there any way to hook a viz sheet into a different data source, assuming the data source has the same formatting as "template" file?
When I need to replace a data source of just one sheet, I copy and paste that sheet into a new workbook. Replace it there, and copy and paste it back to my original workbook.
A quick look on google brought up this: https://community.tableau.com/ideas/1156
It shows first that there is no "Replace source for current sheet"function as such but also gives a workaround for that:
Create bookmark (details: https://onlinehelp.tableau.com/current/pro/desktop/en-us/save_savework_bookmarks.html)
Rename original datasource
Re-import bookmark
This creates a second instance of the data source for the bookmarked sheet
Change the newly created datasource which is only used on one sheet

Is it possible to change the way a form loads with different data fields and values (Acces 2010)

I have Access 2010. I was wondering if there is a way to get the form to load different for every selection.
Example
Item A has 10 Rows and 6 columns of filled in data
Item B has 3 Rows and 2 Columns of filled in data
Both are from the same table.
Is there a way when a certain item is selected from a drop down menu to load, without having multiple forms, only the filled in data? Output would resemble Excel format.
Thank you in advance for any help.
Quick Answer (TL;DR)
Creating dynamically-generated form structure in MSFT Access can be done with sub-forms.
Detailed Answer
Context
MSFT Access
Creating forms
Problem
Scenario: Developer wishes to create context-specific form structure that depends on the query output.
Solution
Create one or more sub-form with attached VBA that changes dependent on the query ouput.
Connect the subform(s) to the primary form and load as needed depending on the context.
See also
https://stackoverflow.com/questions/tagged/ms-access+forms+vba
https://duckduckgo.com/?q=msft+access+dynamic+subform
How to dynamically load, access and unload subforms in microsoft access

2d form for data entry in Access

I'm using Access 2010 and I would like to create a form where useres can enter data much like they can in an Excel format. The users need to enter a date when a step is complete for a specific unit.
In Excel the units run aross the top row, the steps run down the left column. In the cell where the unit and step meet, you put a date when it is done. In Access it is much harder to create a form that looks like this (at least it has been for me so far). I tried to use a crosstab query, but you cannot enter information into a crosstab query. I can do a massive form listing every combination of units and steps, but there are over 50 units and each one has 63 steps. I don't want users to have to look through a form with over 3,000 lines in it just to enter a date completed.
This definitely feels like something we should be using a database for instead of an Excel spreadsheet. I have the format for the back end tables to hold the data. My problem is how to create a form that is easy for the user to enter the dates.
I think you have three options. First, you could build the form from scratch, which you've already admitted would suck. And it would take a lot of VBA to get the data in the right place. Second, you could automate Excel - it's the same as the first method but you don't have to build the form. You would populate an Excel spreadsheet and write the changes back to the database. This is not a trivial task and I don't recommend it.
The third option is to throw away the idea that you want to do this in a grid. You've probably been doing it in Excel and to the extent that you replicate that, your users will be happy and comfortable. Moving to a database gives you benefits, but there are costs. This is one of the costs.
So create a form with a dropdown containing all of the units. When a unit is selected, populate a subform (datasheet view) listing all of the procedures and dates. The user can then select the unit, and fill in the date next to whichever procedures he wants. Then he can select another unit and do the same thing. If you set it up right, your data will flow to the tables automatically and you'll get all the benefits of data validation, input masks, relationships, and whatever else you're using at the table level.
I know that's not what you were looking for, but I think it's the best way forward.

How to configure an "on edit" trigger on a file created automatically (with a google script)?

I have followed the following tutorial : https://developers.google.com/apps-script/storing_data_spreadsheets#writing-1.
First, I have a source spreadsheet with the following columns ( First Name, Last Name and Department) and associated data (see a screenshot of the source file here : https://developers.google.com/apps-script/images/reading_spreadsheet_data_image1.jpg).
Then, I dynamically create one Sheet per department name (see tutorial code) : every sheet contains the information about employees in that department. (see tutorial screenshot).
I have customized this tutorial to create, dynamically, one Spreadsheet per departement instead of one Sheet per department.
When each child Spreadsheet is modified, i want to launch an "On Edit" trigger. This "On Edit" trigger will re-generated the source spreadsheet with all child spreasheets data.
I have tested this functionnality but it seems that i can't program the creation of an "OnEdit" trigger on a distant spreadsheet (execution validation issue). It seems that only a manual creation (of the "On Edit" trigger) is possible.
Is it possible to create, dynamically with Google Script, a trigger on a distant spreadsheet ?
Best Regards
You can create a trigger function that handles events from remote spreadsheets or forms. See Class Triggerbuilder.
Your trigger function must be accessible to the script creating the trigger - in other words, it must be part of the same script.
var ssKey = 'XXXXXXXXXXXXXXXXXXXXX';
function myFunction() {
ScriptApp.newTrigger('myOnEdit')
.forSpreadsheet(ssKey)
.onEdit()
.create();
}
function myOnEdit(e) {
Logger.log(JSON.stringify(e));
}
Of course, you'll want to do something useful in the trigger function, but this is just an example.
There is an issue to be aware of. This remote function will not receive the documented source property documented under "Spreadsheet Edit Events" in Understanding Events. See Issue 2856, and star it for updates.
Why does that matter? If that worked, you MIGHT be able to have the same trigger function registered to handle events from ALL your spreadsheets, and use the source property to work on one sheet at a time.