Open Kirajav opened 4 years ago
Thank you for your comment. In my environment, I could confirm that your script works. In your ranges, the values are retrieved from the cells of "A1", "B2", "C3:D4" on the 1st tab in the active Spreadsheet. Ref
Thank you by your quick response!
yeah, but i expected an array with just the values as the original .getValues();
method response in GAS
Thank you for replying. Unfortunately, this library uses Sheets API. So in the current stage, your goal cannot be directly achieved. This is due to my poor skill. I deeply apologize for this.
No, don't worry, actually you are more skilled than me! but thank you anyway! I'll try to investigate more and if i find the problem, I'll let you know it. And again, thanks for sharing!
I would like to consider for implementing this in the future update. Thank you for proposing this.
Thank you by your quick response! yeah, but i expected an array with just the values as the original
.getValues();
method response in GAS
@Kirajav How should that even work? There is no strict requirement on the size of any individual range, so you can end up with a very jagged array. Nor is there a requirement that only row-oriented ranges are provided.
E.g., what sort of response do you expect from this library's getValues()
when the ranges in the RangeList are A1:A100
, A1:ZZ1
, B5
, C10
, F2:G2
, and AAB3
?
@tehhowch Thank you for your support. Your comment helps me think of the Kirajav's comment. I could notice that my understanding of it was not correct. So I would like to wait for Kirajav's replying.
@tanaikech i expected to get an array of arrays, i mean, something like this:
[[1,2,3],["A","B","C"],["John", "Marie", "Susane", "Lois"],["something"]]
if each rage you mentioned has that respective data in the respective cells.
But, with this library, the function getValues()
returns me the ranges' names like this:
[{values=[[Nombre]], range=Data!A1}, {values=[[123141445]], range=Data!B2}, {range=Data!C3:D4}]
Thank you for replying. The returned values are the array object. So in this case, as the current workaround, how about creating the array, that you want, from the returned values using a script?
@Kirajav you are one simple step from your desired output: instead of an array of 2D arrays, you have an array of objects, each of which has the 2D array you want as a named property. Just map
the return value:
...getValues().map(function (result) {
return result.values;
});
That this library provides the reference of the source range and not just the values is actually a good thing, as it decreases coupling and improves the ability of consuming applications to work with the library.
Your simple example, a little bit modified:
returns me:
in log console, but not the actual data values in cells for each range as expected.