Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: getting error "Those columns are out of bounds" #20

Open
manuariza opened this issue Aug 10, 2020 · 0 comments
Open

Issue: getting error "Those columns are out of bounds" #20

manuariza opened this issue Aug 10, 2020 · 0 comments

Comments

@manuariza
Copy link

Description of issue

When running the function I'm getting the error:

Execution failed: Those columns are out of bounds. (line 213, file "Code", project "SheetConverter") [9.712 seconds total runtime]

Seems the issue is around this part of the code:

  for (var col=startCol; col<=lastCol; col++) { 
    colWidths.push(120==sheet.getColumnWidth(col)?100:sheet.getColumnWidth(col));
    tableWidth += colWidths[colWidths.length-1];
  }

Cell Format exhibiting problem

I'm pulling the range I want to send over email in with formating this way: var range = s.getRange(4,2,s.getLastRow(),46);

If I change column 46 to column 45, the issue is solved, but it will exclude column 46 from the output. Sounds like column 46 was out of range, but it actually exists (used COLUMN() function to be sure is they right number). I also tried getMaxColumns() with the same result.

Here's the full function I'm using,

function myFunction() {
  var s = SpreadsheetApp.getActive().getSheetByName('MYSHEETNAME');
  var range = s.getRange(4,2,s.getLastRow(),46);
  var to = "MYEMAIL" ;
  var htmlTable = SheetConverter.convertRange2html(range);
    Logger.log(htmlTable);

  var body = "Launches with timeline changes:<br/><br/>"
     + htmlTable
     + "<br/><br/>"
   MailApp.sendEmail(to, 'Subject', body, {htmlBody: body})
   
   var rangesToClear = ["B5:AT"];   
    for (var i = 0; i < rangesToClear.length; i++){
    s.getRange(rangesToClear[i]).clearContent();
  }
}

Expected result vs Observed result

Should be getting the full range from column 2 to column 46, and from row 2 to the last empty row.

Installed Library Version

Version 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant