Been scouring the internet but not found a solution
Basically I am wanting to paste data in the next available row in a specific column.
The column i want to paste into is H
Example - Cell H1 and H2 has data inside it - so i need the code to paste the values in H3 (next available cell)
Thanks
Been scouring the internet but not found a solution
Basically I am wanting to paste data in the next available row in a specific column.
The column i want to paste into is H
Example - Cell H1 and H2 has data inside it - so i need the code to paste the values in H3 (next available cell)
Thanks
Share Improve this question asked Jul 27, 2017 at 14:44 RedexRedex 911 gold badge2 silver badges13 bronze badges 1- 1 stackoverflow./questions/73777592/… is probably the shortest way – PhistucK Commented Apr 16, 2023 at 12:45
2 Answers
Reset to default 3got it working in the end.. For those of you interested my code is below
function putInNextAvaibleRow() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sht = ss.getSheetByName('Test'); //Rename to your sheet
var row=1; //start row to loop through
var col=8; //column you want to loop through
var value=34567; //value you want to assign - can be a cell or anything
while(sht.getRange(row,col).getValue()!=""){
row++;
}
sht.getRange(row,col).setValue(value);
Browser.msgBox("Sheet is "+row+".");
}
You can't access user's clipboard, Google drive API don't give this possiblity. But, you can put data in the next available row in a specific column. Here's the solution :
function putInNextAvaibleRow(sheet,col,value) {
var row=1;
while(sheet.getRange(row,col).getValue()!=""){
row++;
}
sheet.getRange(row,col).setValue(value);
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744739852a4590963.html
评论列表(0条)