質問編集履歴

1

GASコードに誤りがありましたので、変更しました。

2022/03/01 05:32

投稿

coool
coool

スコア29

test CHANGED
File without changes
test CHANGED
@@ -101,8 +101,12 @@
101
101
  var value = route.legs[k];
102
102
  if (result=="distance"){
103
103
  value = value.distance.value/1000; //kilometer
104
+ changesheet1.getRange(2+k,4).setValue(value);
105
+
104
106
  } else if (result=="duration"){
105
107
  value = value.duration.value/60; //minutes
108
+ changesheet1.getRange(2+k,5).setValue(value);
109
+
106
110
  }
107
111
  }
108
112
  }
@@ -112,24 +116,22 @@
112
116
  }
113
117
 
114
118
  function MAP1(){
115
- if(changesheet.getRange("A2").getValue() != ""){
119
+ if(changesheet1.getRange("A2").getValue() != ""){
116
- var src = changesheet.getRange("A2").getValue();
120
+ var src = changesheet1.getRange("A2").getValue();
117
- var dest = changesheet.getRange("B2").getValue();
121
+ var dest = changesheet1.getRange("B2").getValue();
118
- var type = changesheet.getRange("C2").getValue();
122
+ var type = changesheet1.getRange("C2").getValue();
119
123
  var result = "distance"
120
- changesheet.getRange(2+k,4).setValue(mapQuery1(src, dest, type, result));
124
+ mapQuery1(src, dest, type, result)
121
125
 
122
- var src = changesheet.getRange("A2").getValue();
126
+ var src = changesheet1.getRange("A2").getValue();
123
- var dest = changesheet.getRange("B2").getValue();
127
+ var dest = changesheet1.getRange("B2").getValue();
124
- var type = changesheet.getRange("C2").getValue();
128
+ var type = changesheet1.getRange("C2").getValue();
125
- var result = "distance"
126
129
  var result = "duration"
127
- changesheet.getRange(2+k,5).setValue(mapQuery1(src, dest, type, result));
130
+ mapQuery1(src, dest, type, result)
128
131
 
129
132
  }
130
133
 
131
134
  }
132
-
133
135
  ```
134
136
 
135
137
  ### 分からないこと