logo
down
shadow

Splitting and Trimming Columns in Google Sheets Script?


Splitting and Trimming Columns in Google Sheets Script?

By : Mohamed Hashish
Date : November 17 2020, 11:55 AM
will be helpful for those in need There are a few ways of doing this but modifying your existing code, you can split() using strings of more than single characters. Whatever you use is omitted.
code :
var split = range[i][0].split(', '); // including space
// ['10', 'Africa High School'] — no white space


Share : facebook icon twitter icon
How can I run my hide/show columns script on multiple ranges of columns in one google sheets spreadsheet?

How can I run my hide/show columns script on multiple ranges of columns in one google sheets spreadsheet?


By : Sada
Date : March 29 2020, 07:55 AM
Hope this helps This should do it for you for a while. All you have to do is type in all the column numbers that you want to hide and show. And it's helpful to run the onOpen function in the script editor so that you can authorize it.
The intermediate function showMyCols and hideMyCols just make it possible to write one function to do the showing and hiding and they keep you from having to worry about how to setup the parameters.
code :
function onOpen(){
  SpreadsheetApp.getUi().createMenu('MyTools')
      .addItem('Show', 'showMyCols')
      .addItem('Hide', 'hideMyCols')
      .addToUi();
}

function showMyCols(){
  showhideCols('3,4,5,6,7,8,9,10',true);
}

function hideMyCols(){
  showhideCols('3,4,5,6,7,8,9,10',false);
}

function showhideCols(colscsv,show){
  var ss=SpreadsheetApp.getActive();
  var sh=ss.getActiveSheet();
  if(!colscsv){
    var resp=SpreadsheetApp.getUi().prompt('Enter Column Numbers separated by commas.', SpreadsheetApp.getUi().Button.OK);
    var cA=resp.getResponseText().split(',');
  }else{
    var cA=colscsv.split(',');
  }
  for(var i=0;i<cA.length;i++){
    if(show){
      sh.showColumns(cA[i]);
    }else{
      sh.hideColumns(cA[i]);
    }
  }
}
Google Script Button to increase value to specific rows and columns in Google Sheets

Google Script Button to increase value to specific rows and columns in Google Sheets


By : user2039146
Date : March 29 2020, 07:55 AM
This might help you There exists:
An setActiveSelection function you could use to select a range of cells when a Player button is clicked, and A getSelection function you could use when an "event" button is pressed (rebound, turnover, or steal) to get the current selection and then select the correct portion of that.
code :
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];

function selectPlayerOneRange() {
  sheet.setActiveSelection("B2:D2");
}

function selectPlayerTwoRange() {
  ...
function getSelectedRow() {
  var sel = ss.getSelection();
  var range = sel.getActiveRange();
  var row = range.getRow();
  return row;
}

function incrementRebound() {
  var row = getSelectedRow();
  var col = 2;
  var cell = sheet.getRange(row, col);
  // Your increment code here:
  var cellValue = cell.getValue();
  cell.setValue(cellValue + 1);
}

function incrementSteal() {
  var row = getSelectedRow();
  var col = 4;
  ...
Modify Code - Copy Certain Rows/Columns From one Spreadsheet to Another - Google Apps Script / Google Sheets

Modify Code - Copy Certain Rows/Columns From one Spreadsheet to Another - Google Apps Script / Google Sheets


By : user3717766
Date : March 29 2020, 07:55 AM
will help you Solution
Here is the code snippet that copies the columns B to E from one sheet to other. Let me know if this is what you meant to achieve with your question.
code :
function CopyNewOnlineSkusFromCDSToGID() {
  // get spreadsheet
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  // get the two desired sheets
  var online = ss.getSheetByName("ONLINESendNewSkusToGID");
  var rect = ss.getSheetByName("RECTOONLINE");
  // get the values of the sheet we want to copy
  var values = online.getRange('B:E').getValues();
  // set the values where we want to paste
  rect.getRange('B:E').setValues(values);
}
Modify Code - Select Certain Columns onEdit. Google Apps Script / Google Sheets

Modify Code - Select Certain Columns onEdit. Google Apps Script / Google Sheets


By : user3723385
Date : March 29 2020, 07:55 AM
it should still fix some issue When the checkbox of the column "J" in the sheet of ONLINERELOCATION is checked, you want to copy the values of the columns "A,D,F,G" to the sheet of SendToTotalSales as "A,F,G,D". You want to achieve this using Google Apps Script.
If my understanding is correct, how about this answer? Please think of this as just one of several possible answers.
code :
function MoveDonations(e) {
  var range = e.range;
  var sheet = range.getSheet();
  if (sheet.getSheetName() == "ONLINERELOCATION" && range.columnStart == 10 && range.columnEnd == 10 && range.rowStart >= 2 && e.value == "TRUE") {
    var [[a,,,d,,f,g]] = sheet.getRange(range.rowStart, 1, 1, 7).getValues();
    e.source.getSheetByName("SendToTotalSales").appendRow([a, f, g, d]);
  }
}
What's the best way to compare two columns of data in Google Sheets and output ONLY the non-matching using Google Script

What's the best way to compare two columns of data in Google Sheets and output ONLY the non-matching using Google Script


By : mmckelve
Date : March 29 2020, 07:55 AM
wish helps you I actually do the same thing on a sheet I use at work. It looks at Col A, and Col C, and the ones from col A that are not in Col C will show up in Col E.
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org