Google Sheets - Autoreplace a value when a new row is created - google-sheets

I use Zapier to create a new row in a Google Sheet doc for each new registration on our website. However, I want to autoreplace a value of a cell when the row is created or, if it's not possible, using a script with onOpen, or any time-based trigger.
Here is an example of the data that needs to be changed in two specific columns (say, A and C)...
/*Job - Column A - English to French*/
'Management':'Gestion',
'Social work':'Travail social',
'Reception':'Accueil',
'Art Therapy':'Art-thérapie',
'Volunteer work':'Bénévole',
/*Workplace - Column C - English to French*/
'Starting Community':'Communauté en démarrage',
'CLAN Program' : 'Programme FER',
'Other (specify)' : 'Autre affiliation',
'University (specify)' : 'Université',
How can I do that? I managed to use an onEdit trigger, but since it can't be activated by Zapier, it's useless.
Thanks!

You cannot achieve this behavior with an Edit trigger in Apps Script.
Zapier will edit the Spreadsheet via API call and this is actually one of the trigger limitations:
Script executions and API requests do not cause triggers to run. For example, calling Range.setValue() to edit a cell does not cause the spreadsheet's onEdit trigger to run.
You should probably craft this auto-replace feature in the Zapier environment directly.
Refer to this documentation for additional Apps Script triggers limitations.

The workaround I use for having automatic functions applied on the row created in a Google Sheet by Zapier is by doing the automation with Google Sheet functions. Your document should have 3 tabs:
Where Zapier will create new rows
On this tab, you will use the IMPORTRANGE function (to import all the data from the tab1).
Where you can do your magic (functions doing exactly what you want, using reference to the cells of the tab2).
Optionally, you can then hide the first 2 tabs, once your setup is complete on the tab3.

Related

Jenkins Confluence Publisher - wiki markup plain text to add data in a new row

How can we append/add new row/new cell at the top of the table, to act as the first row, below the headers using wiki mark up tokens. ?
I use Jenkins confluence publisher to send values from Jenkins build to a cell in a table in the confluence page. As I run the job daily, I need the Jenkins job to append the new details at the first row and eventually the yesterday's job details will be pushed down to the second row.
before21 token returns results that should come under the column H1 while before 31 values under column H2. I tried to create a cell within the existing cell using |cell| and {{!}}, but none of them works for me as these tokens are inside the table. As shown in the screenshot below, the values are getting added to the same cell instead of new cell.
I am unsure if I can create a row for before21 and use the same new row for before31. The values for these tokens are passed as plain text option from the Jenkins confluence publisher, which will eventually be in the new rows. The plain text supports wiki markup format.
https://www.jenkins.io/doc/pipeline/steps/confluence-publisher/
Can you guys please direct me where am I doing wrong and how can I achieve this?
I use confluence 7X. In Edit mode the page looks like
This is post update
This is achieved by posting content in HTML format.

Triggering a script on a google sheet after editing a separate sheet

Hello, I am making an initiative table for D&D using google sheets.
At the moment I have a Mainsheet in which myself (the DM) can edit and change, and Playersheet that has the data the players need using IMPORTRANGE.
I am attempting to write a script that will automatically hide all empty "initiative" cells in PlayerSheet .
I have successfully coded this script, however I would like it to trigger any time I edit the MainSheet.
Because all the date in the sheet comes from using IMPORTRANGE I am not able to use the on edit trigger, as the PlayerSheet is never edited.
Is it possible to have the script located in PlayerSheet run whenever I edit MainSheet?
On top of that would it be possible to have the script only run when I edit data in the F column?
To run the script whenever you edit your spreadsheet, you can create a fonction on edit.
function onEdit(e){
var range = e.range;
//here you can check if the column if F or not and run your code.
}
Tu change the values of another spreadsheet, when selecting the spreadsheet you want to do the actions on, instead of selecting the active one, you can edit one with the url. Something like :
var doc = SpreadsheetApp.openByUrl("paste the url here");
var sheet = doc.getSheetByName("Name of the sheet");
etc...
And then do the modifications you need to do on the players spreadsheet.

On Form Submit, How do I update another sheet with some of the new information?

So I am essentially trying to do what Zapier does with it lookup row and update row as needed. I can't use Zapier for our team's purposes because I can't work with the 15 minute ish delay.
1 - User sends data via form to Sheet A.
2 - User then needs to update information in Sheet A by submitting new data to sheet B via another Form.
3 - Data in sheet B is then matched up with row data in sheet A via the "ID".
4 - Sheet B Data then overwrites Sheet A data.
I feel like this should be simple...
Try using Forms Service, Spreadsheet Service, Triggers and Events
Form Service
This service allows scripts to create, access, and modify Google Forms.
Spreadsheet Service
This service allows scripts to create, access, and modify Google Sheets files.
Triggers and event
Triggers let Apps Script run a function automatically when a certain event, like opening a document, occurs. Simple triggers are a set of reserved functions built into Apps Script, like the function onOpen(e), which executes when a user opens a Google Docs, Sheets, or Forms file.
Using Form submit trigger you can catch the form values using ItemResponse method, get the details from the previous sheet using getValues(). Compare the two sets of values then make neccessary updates.
Hope it helps.

Bringing in a google form response to a sheet

Here is a copy of the sheets and form (form > go to live)
https://docs.google.com/a/ncsu.edu/spreadsheets/d/1mEz9mLEgP4Cfts2ZU6NwhNiL6xjWdFbt42RUj-RYbZw/edit?usp=sharing
So currently, I get responses in a different sheet. Ideally, I would get the response on the tracking sheet with the appropriate format for the dates. Additionally, I would like to keep the functionality of the tracking sheet which is to be able add in items by hand and not through the form. I currently have a script in place which auto-inputs the current date as the two separate formats.
So I'm looking for a solution which either takes in form response to the sheet and appropriate cells (the first empty cell). Or I'm looking to create a script which onEdit which when the form sheet is edited, will fetch the new response and copy it over appropriately onto the tacking sheet.
I have tried googling answers.. But I think I may be a failure at it since I wasn't able to really find a solution for this particular problem. Thank you in advance for the help!
form:
https://docs.google.com/forms/d/1AHSQrLkq3U7NJMvgWoH3lAygova7Mi4BaXHdROaaS2g/edit?usp=sharing
The script associated to this form should do the trick.
All the explanations on how to use it are in the response sheet

How to get a specific URL of Google Sheet automatically

I would like to get Google Sheet's URL automatically when there is a specific no. in row A and a sheet name provided as prerequisites.
If there is 15106 in row A and a sheet name --> See this
I would like to display it somewhere on the same line with the number.
You can try writing an onEdit() function that gets the URL when the sheet is edited - you can tell the function to look for specific ranges and values as you desire. You will have to assemble the url yourself using spreadsheet ID, which you can get using SpreadsheetApp.getActiveSpreadsheet().getId(). See Google's guide to triggers for more information on onEdit().

Resources