7

I've been doing a lot of work with Google Script to automate some peer evaluation processes.

One result is a spreadsheet with a lot of review data that I need to sort, group and summarize. The script is working fine for the hard-coded sort column.

But I really want to be able to sort on different columns at different times, and I'd like the sort/group/summarize script to prompt the user to select the sort/group column at runtime.

I've explored the UI stuff a bit, but I haven't seen how to prompt the user to select a range (or column or anything else) on the sheet.

Thanks in advance.

user2782208
  • 81
  • 1
  • 4

2 Answers2

2

I know you are not supposed to post links as answers, but sometimes it just makes sense.

This answer gives a complete solution that I have not tested.

https://stackoverflow.com/a/45427670/188963

This post also describes something similar.

https://medium.com/@piyush.goel/how-to-build-a-range-picker-in-google-apps-script-to-populate-a-text-field-in-the-sidebar-in-google-6bbd4f80d4d2

abalter
  • 9,663
  • 17
  • 90
  • 145
-2

A simple way to communicate with user on a spreadsheet is to use the Browser.msgBox or Browser.inputBox to indicate that you expect a column / range to be selected. You can then find out which range is selected and compare that with your expected selection choices.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
patt0
  • 810
  • 4
  • 8
  • What would trigger the second part of the operation? – Mogsdad Sep 19 '13 at 17:20
  • Its a little difficult to imagine the system, but in a simple system, I would close the dialog if no "specific" column is selected and the answer to the prompt is that "regular" sorting is not what is expected. The user then selects the range and clicks on the menu item again ? – patt0 Sep 19 '13 at 17:27
  • Yeah, that might work. The lack of direct feedback makes it challenging. Might instead prompt the user with the current column they are in, "Sort by 'XYZ'?", with ok / cancel buttons. They would quickly learn the behavior of "move to column, select 'sort' menu item". – Mogsdad Sep 19 '13 at 17:56