回答編集履歴

2

 

2022/10/24 13:07

投稿

退会済みユーザー
test CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  https://docs.gspread.org/en/v5.6.1/api/models/spreadsheet.html?highlight=batch#gspread.spreadsheet.Spreadsheet.batch_update
5
5
 
6
- たとえば下記は、セル(1.1)入され数字を「lastrow」とした場合に、[lastrow - 1]行目の4列目~21列目、125列目、240列目、274列目~276列目の数式をコピーし、
6
+ たとえば下記は、セルA1に入されている数字を「lastrow」とした場合に、[lastrow - 1]行目の4列目~21列目、125列目、240列目、274列目~276列目の数式をコピーし、
7
7
  lastrow~[lastrow+99]行目までの100行にペーストするものです。
8
8
 
9
9
  ※ batch_update 含め、gspread 全般は実行すると内容を元に戻せなくなります。したがって、意図しない挙動で数式を含めたシートの内容を壊したくない場合は、実行の都度オリジナルのスプレッドシートをコピーしてテストしてください。

1

 

2022/10/24 12:35

投稿

退会済みユーザー
test CHANGED
@@ -58,9 +58,9 @@
58
58
 
59
59
 
60
60
  batch_copy_paste(ss, worksheet, lastrow-1, lastrow-1, 4, 21, lastrow, lastrow + 99, 4, 21)
61
- batch_copy_paste(ss, worksheet, lastrow-1, lastrow-1, 125, 125, lastrow+1, lastrow + 99, 125, 125)
61
+ batch_copy_paste(ss, worksheet, lastrow-1, lastrow-1, 125, 125, lastrow, lastrow + 99, 125, 125)
62
- batch_copy_paste(ss, worksheet, lastrow-1, lastrow-1, 240, 240, lastrow+1, lastrow + 99, 240, 240)
62
+ batch_copy_paste(ss, worksheet, lastrow-1, lastrow-1, 240, 240, lastrow, lastrow + 99, 240, 240)
63
- batch_copy_paste(ss, worksheet, lastrow-1, lastrow-1, 274, 276, lastrow+1, lastrow + 99, 274, 276)
63
+ batch_copy_paste(ss, worksheet, lastrow-1, lastrow-1, 274, 276, lastrow, lastrow + 99, 274, 276)
64
64
 
65
65
 
66
66
  ```