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

Single Cell endRowIndex #1

Closed
Max-Makhrov opened this issue Aug 23, 2023 · 3 comments
Closed

Single Cell endRowIndex #1

Max-Makhrov opened this issue Aug 23, 2023 · 3 comments

Comments

@Max-Makhrov
Copy link

Dear Tanaike, I use this script a lot in my work. thank you a ton!

Here's the issue I found:

Sample Code

function testApp() {
  var a1Notation = 'K1';
  var sheetId = 500;
  console.log(UtlApp.convA1NotationToGridRange(a1Notation, sheetId));
}

Output

{ sheetId: 500,
  startRowIndex: 0,
  endRowIndex: 1,
  startColumnIndex: 10,
  endColumnIndex: 1 }

Expected output

{ sheetId: 500,
  startRowIndex: 0,
  endRowIndex: 1,
  startColumnIndex: 10,
  endColumnIndex: 11 }

Steps to reproduce

  1. Install the library
  2. run sample code

Proposed solution

My guess is that it is a logical error in this line:

endColumnIndex: end ? end.col + 1 : 1,

I suggest to change it like this:

endColumnIndex: end ? end.col + 1 :start.col+1

If I did not understand the logics of grid creation, I'm sorry.

I also suggest to create a type for a grid like so for autocompletion purposes:

/**
 * @typedef {Object} RangeGrid
 * @property {Number} startRowIndex
 * @property {Number} endRowIndex
 * @property {Number} startColumnIndex
 * @property {Number} endColumnIndex
 */

 *
 * ...
 * @returns {RangeGrid} Gridrange.
 */
function convA1NotationToGridRange_(a1Notation, sheetName) {
@tanaikech
Copy link
Owner

Thank you for your support. And, I apologize for my late response. Now, I noticed your comment.

From your comment, I confirmed it. So, I updated this library as v1.0.1. Could you please confirm it?

Thank you so much.

@Max-Makhrov
Copy link
Author

Max-Makhrov commented Nov 15, 2023

Thanks, @tanaikech !

Your library and no-apps-script approach makes scripts work much faster, and also help developing Front-End part. conv-functions became my best friends :)

@tanaikech
Copy link
Owner

Thank you for replying. Yes. This repository publishes the functions as both a library and the standalone functions in order to match the user's situation. I'm glad that those are useful for your situation. I would like to grow this repository by adding various functions.

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

2 participants