Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30178 > unrolled thread

Automatically Expand the Number of Columns Encompassed in a JavaScript Function

Started byottopageken@gmail.com
First post2016-04-01 17:40 -0700
Last post2016-04-02 20:02 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Automatically Expand the Number of Columns Encompassed in a JavaScript Function ottopageken@gmail.com - 2016-04-01 17:40 -0700
    Re: Automatically Expand the Number of Columns Encompassed in a JavaScript Function Scott Sauyet <scott@sauyet.com> - 2016-04-02 20:02 +0000

#30178 — Automatically Expand the Number of Columns Encompassed in a JavaScript Function

Fromottopageken@gmail.com
Date2016-04-01 17:40 -0700
SubjectAutomatically Expand the Number of Columns Encompassed in a JavaScript Function
Message-ID<e6835ec2-1087-4c90-997b-7138b6642d91@googlegroups.com>
I have a function similar to the following: 
function Tabulate() {
  var spreadsheetAll = SpreadsheetApp.getActiveSpreadsheet();
  var currentSheet = ss.getSheetByName("XYZ");
  var $CountofColumnsinSheet= 27
  var $combinedAll=   currentSheet.getRange(27,2,currentSheet.getLastRow(),1).getValues();
  var count = [];
  for (var i=0; i<$combinedAll.length; i++) {
    if ($Combined[i]!="") {
      count.push(1);
    }    

I plan on adding more columsn so that var $CountofColumnsinSheet will grow to 28 or 29 or 30. I don't want to have to go into my Script Editor to constantly change the var $CountofColumnsinSheet to some incrementally larger number and then make appropriate changes in var $Combined where I would need to change the initial 27 to 28 or 29. Is there a function in JavaScript that automatically expands to fill in any additional columns to the right that are created?

[toc] | [next] | [standalone]


#30193

FromScott Sauyet <scott@sauyet.com>
Date2016-04-02 20:02 +0000
Message-ID<ndp8hh$g3u$1@dont-email.me>
In reply to#30178
ottopageken wrote:

> I have a function similar to the following:
> function Tabulate() {
>   var spreadsheetAll = SpreadsheetApp.getActiveSpreadsheet();
>   var currentSheet = ss.getSheetByName("XYZ");
>   var $CountofColumnsinSheet= 27 
>   var $combinedAll=   currentSheet.getRange
>     (27,2,currentSheet.getLastRow(),1).getValues();
> [ ... ]
> I plan on adding more columsn so that var $CountofColumnsinSheet will
> grow to 28 or 29 or 30. I don't want to have to go into my Script Editor
> to constantly change the var $CountofColumnsinSheet to some
> incrementally larger number and then make appropriate changes in var
> $Combined where I would need to change the initial 27 to 28 or 29. Is
> there a function in JavaScript that automatically expands to fill in any
> additional columns to the right that are created?

You have not given enough context here.  What environment is this in 
which you're editing spreadsheets?  What do you mean by "automatically 
expands to fill in any additional columns"?  Are you expecting something
to add data to a spreadsheet to accomplish this?

Please start over and start from the beginning.  What are you trying to 
do, and where are you attempting it?

  -- Scott

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web