Комментарии:
Figured out how to do this for my sheet and thought a second example might be helpful if you were struggling like I was:
function AddtoTimeSheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var inputSheet = ss.getSheetByName("Input");
var timeSheet = ss.getSheetByName("Time Sheet");
var requiredTest = inputSheet.getRange('B17');
if (requiredTest == 'Good') {
var nextRow = timeSheet.getLastRow() +1;
var getCopyRange = inputSheet.getRange('C2');
getCopyRange.copyTo(timeSheet.getRange(nextRow, 1));
var getCopyRange = inputSheet.getRange('C4');
getCopyRange.copyTo(timeSheet.getRange(nextRow, 3));
var getCopyRange = inputSheet.getRange('C6');
getCopyRange.copyTo(timeSheet.getRange(nextRow, 5));
var getCopyRange = inputSheet.getRange('C8');
getCopyRange.copyTo(timeSheet.getRange(nextRow, 2));
var getCopyRange = inputSheet.getRange('C10');
getCopyRange.copyTo(timeSheet.getRange(nextRow, 4));
inputSheet.getRange("C2:C10").clear();
} else {
inputSheet.getRange('C12').setValue(['Error']);
}
}
Can we copy the column headers too?
ОтветитьHello Curt,
Can we update same data(like column name, formula etc...) of many google sheets at a time using only one google sheet's app script? If yes then how? Please make a video
Hey Curt. Just watching your video to get an idea of a copy function. Basically for mine i am trying to copy 3 specific cells values (H7:J7) and past them on the same sheet in the next available row in columns C,D,E. i am fairly new to this but is there a video that you do that comes closer to what i am attempting do?
ОтветитьHow to copy new data from SHEET A to a next blank row in SHEET B? The data from Sheet A can be deleted and new data copied from SHEET A on SHEET B should remain intact. Anyone knows how to do it? ThaNks
ОтветитьHi. Would like to ask if you can give me script for the generation of number starting from 1 to 1000000 that I can use for automatic generation of Request #.
ОтветитьGood morning! Could you please give me the script to make +1 of a cell each time a button is clicked? Thank you so much ! : D
ОтветитьHi Kurt! Great work. thanks! Wonder if you could give me a Quick hand. Here is the thing. From Sheet1 which receives data from a GG form, I want to copy the last row of data from column 2 to let’s say column 6. Go to Sheet2 and paste « Values » in the first available empty row. I will run this script from a button. Hope you find the time to give me a quick heads up. Best. Jacques
ОтветитьHi, thanks for the great video.
Can we replace the row of data but determine by date (today()) in another sheets.
So the set values not on the last row but within the data, the new data will replace the old data but determined by date today.
How i chose one row range?
Ответитьthanks its working
ОтветитьHi i want to add data in the last row, how can be possible
ОтветитьHi Curt!,
This is very helpful for me!. However, after using this and attach to a button
When I have data of 100 rows, button is needed to click several times to execute call.
Is there any method that can use ur function to execute by a single click.
hi, what if I only want to populate the data from row 13 to row 22, not from the last row like in video?
ОтветитьCould you please help me 😭 I'm struggling a lot
I need solution for my problem.
I have data having in single cell i.e
[Invoice I'd ][ product ID's][all item's][ all item's quantity][ item's price]
Ex:
[7085][432,444,456][item1,item2,item3][1,2,1][$10,$30,$10]
Consider [ ] as single cell
I want output in row wise
Like
[7085][432][item1][1][$10]
[7085][444][item2][2][$30]
[7085][456][item3][1][$10]
I'm already tried
Split and TRANSPOSE(SPLIT ())
Tried to create custom functions but I failed 😔
Please suggest any other ways to achieve required output
I have huge data I'm not able to do this process manually so I'm trying to find dynamic ways please help me 🙏🙏
Thank you ❤️
Hi , Can you copy a row with formulas from the Source sheet and dynamically paste it to a variable row within the range in the Target Sheet. Note: The target row is variable because data are constantly being added.
ОтветитьSir please make a video importrange formula in script
ОтветитьHi Curt,
Great video. I'm trying to copy one tab's (tab1) values to another tab (tab2) in the same spreadsheet. If column 2 has a certain string value I don't want to copy that entire row. How could I rewrite the IF statement in your script if column 2 contains an invalid string and I can avoid copying the entire row from tab1 to tabl2?
Thank you in advance.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuSheet = ss.getSheetByName("Menu");
var inventorySheet = ss.getSheetByName("Inventory");
menuSheet.getRange(A1:B1").clear();
var partNumber = menuSheet.getRange(1, 1).getValues();
var lastRow = inventorySheet.getRange(1, 1).getValue();
var foundRecord = false;
for(var j = 2; j<lastRow; j++)
{
if(inventorySheet.getRange(j,1).getValue() == partNumber)
{
var nextRow = menuSheet.getLastRow() + 1;
var getCopyRange = inventorySheet.getRange('A' + j + ':C'+j);
getCopyRange.copyTo(menuSheet.getRange(nextRow, 1);
foundRecord = true;
}
}
if(foundRecord == false)
{
menuSheet.getRange(5,1).setValue(['(NO RECORDS FOUND')];
}
Hi gr8 work , sorry I didn't get code in any comments
ОтветитьI've been searching the web for quite a bit of time to find this script and your video explained it so clearly and was easy to follow in just a matter of minutes. Thanks so much!
Ответитьscript to this code?
ОтветитьVs importrange . Which one better
ОтветитьCode in Video Below:
function CopyRow() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuSheet = ss.getSheetByName("Menu");
var inventorySheet = ss.getSheetByName("Inventory");
menuSheet.getRange("A5:C1000").clear();
var partNumber = menuSheet.getRange(1,1).getValue();
var lastRow = inventorySheet.getLastRow() + 1;
var foundRecord = false;
for(var j = 2; j < lastRow; j++)
{
if(inventorySheet.getRange(j,1).getValue() ==partNumber)
{
var nextRow = menuSheet.getLastRow() +1;
var getCopyRange = inventorySheet.getRange('A' + j + ':C' + j);
getCopyRange.copyTo(menuSheet.getRange(nextRow, 1));
foundRecord = true;
}
}
if(foundRecord == false)
{
menuSheet.getRange(5,1).setValue(['(NO RECORDS FOUND)']);
}
}
Is there a link to this script somewhere?
ОтветитьHello Curt! Nice video, very informative. I have tried to find a script that copy values from one sheet to another in google sheets, but the values are in different cells and in different columns. What I want is to get all that values and copy to destination sheet in one single row. Is there a function or sometning to do that?
ОтветитьI have been searching a while for this information, thanks a lot, great video
Ответить