Hi,
I added a button to my project. I need an action for the button to duplicate column K to L, L to M and so on.
Hi,
I added a button to my project. I need an action for the button to duplicate column K to L, L to M and so on.
I assume you want the column name to be dynamically inserted as well. What’s your use case here?
Hi mkukulka,
How about setting up a GAS on the spreadsheet side and running it from a button in the app?
Specifically…
Setup on the spreadsheet side
doGet(e)
function.Settings on the app side (Glide)
The following are reference websites.
https://stackoverflow.com/questions/30126787/call-a-custom-gas-function-from-external-url
https://mini-developer.work/insert-or-add-a-column/
I hope it works.
@ThinhDinh yes I want column name to be copied as well.
@mrnmkmn uhh… there is nothing less complicated? I am not good at developing.
Scripts, as @mrnmkmn pointed out is your best bet. As of now we can only add new rows from an app, not columns.
Hi guys.
OK, I got the script
function doGet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getActiveSheet();
var col = sh.getLastColumn();
var colContents = sh.getRange(1, col).getValue();
var previousHeaderNum = colContents.toString().replace(/\D/g, '');
var headerNum = (parseInt(previousHeaderNum, 10) +1);
var header = "ObciÄ…zenie " + headerNum + " tyg."
sh.insertColumnAfter(col);
sh.getRange(1, col+1).setValue(header);
}
When I run the script from script.google.com it runs OK. Bur how to set a button on GlideApp to run the script to get next column on spreadsheet and next row in app? I tried to use it with webhook but it is not workin.
Link to app: https://silowy.glideapp.io/ → Trening 3 tab
You can use Glide to change a value in your spreadsheet (anywhere), and then detect that change with an onChange() trigger. That trigger can then fire your script. I demonstrated this technique in my Apps Script JSON API tutorial.