Groups
Groups
Sign in
Groups
Groups
Google Apps API Japan
Conversations
Labels
About
Send feedback
Help
スプレッドシートでSortができません
1,052 views
Skip to first unread message
がぷ
unread,
Apr 8, 2015, 9:54:12 PM
4/8/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
いつもお世話になっております。
Sortについて質問があります。
どなたかお答えいただけないでしょうか?
function sortData(){
var sheet1 = SpreadsheetApp.getActive().getSheetByName('予定入力');
var WrkRange=sheet1.getRange("a2:t4000");
WrkRange.sort([
{column:2, ascending:true},
{column:14, ascending:true},
{column:3, ascending:true}
]);
}
上記ファンクションを作成し、実行すると
【並び替えの範囲には、フォームシートのすべての列を含める必要があります。】
というエラーが発生します。
指定したシートには、A~Tまでしかなく、なぜこのようなエラーが出るのか見当がつきません。
宜しくお願い致します。
西昭宣
unread,
Apr 9, 2015, 1:48:49 AM
4/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
var WrkRange=sheet1.getRange("a2:t"); //
のようにgetRangeの範囲を変えてみたらどうですか?
function sortData(){
var sheet1 = SpreadsheetApp.getActive().getSheetByName('予定入力');
var WrkRange=sheet1.getRange("a2:t"); //
WrkRange.sort([
{column:2, ascending:true},
{column:14, ascending:true},
{column:3, ascending:true}
]);
}
2015年4月9日木曜日 10時54分12秒 UTC+9 がぷ:
がぷ
unread,
Apr 9, 2015, 2:58:48 AM
4/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
西昭宣
様
ご回答ありがとうございます。
教えていただいた通りにしたのですが、結果は同じでした。
2015年4月9日木曜日 14時48分49秒 UTC+9 西昭宣:
西昭宣
unread,
Apr 9, 2015, 3:47:24 AM
4/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
現象を確認できました。
普通のシートであれば、そのエラーは出なかったのですが、フォームのシートに関してはエラーが出るようです。
以下、1列だけの参照ですがフォームのシートで並び替えができたので、掲載します。
function sortData(){
var sheet1 = SpreadsheetApp.getActive().getSheetByName('予定入力');
sheet1.sort(2,true);
// sheet1.sort(2,true).sort(14,true).sort(3,true); //これはどうでしょうか?
}
範囲ではなく、シートでソートをするというものらしいです。
よろしくお願いします。
参考
Apps Scripts error - Sort range must include all columns on a form sheet
http://stackoverflow.com/questions/21832402/apps-scripts-error-sort-range-must-include-all-columns-on-a-form-sheet
2015年4月9日木曜日 10時54分12秒 UTC+9 がぷ:
がぷ
unread,
Apr 9, 2015, 5:58:13 AM
4/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
西昭宣
様
ありがとうございました。
教えていただいた方法でできました。
お時間を使っていただき感謝いたします。
2015年4月9日木曜日 16時47分24秒 UTC+9 西昭宣:
Reply all
Reply to author
Forward
0 new messages