How can I do a script with a button in Google spreadsheets to copy a row, paste it at…
- User
How can I do a script with a button in Google spreadsheets to copy a row, paste it at the last blank row in another sheet
- Assistant
To create a script with a button in Google Sheets that copies a row from one sheet and pastes it at the last blank row in another sheet, you can follow these steps:
-
Open the Google Sheets document where you want to add the button.
-
Click on "Extensions" in the top menu, then select "Apps Script."
-
Delete any code in the script editor and paste the following code:
function copyRow() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sourceSheet = ss.getSheetByName("Source Sheet Name"); var destinationSheet = ss.getSheetByName("Destination Sheet Name"); var sourceRow = 1; // Change this to the row number you want to copy var sourceRange = sourceSheet.getRange(sourceRow, 1, 1, sourceSheet.getLastColumn()); var values = sourceRange.getValues(); var destinationRange = destinationSheet.getRange(destinationSheet.getLastRow() + 1, 1); destinationRange.setValues(values); } -
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Unspecified NVIDIA model (HelpSteer2)Compare side by side →
Unspecified NVIDIA model (HelpSteer2)Compare side by side →
Unspecified NVIDIA model (HelpSteer2)Compare side by side →
Unspecified NVIDIA model (HelpSteer2)Compare side by side →
- Unknown modelCompare side by side →
- Unknown modelCompare side by side →