Enhance Productivity with Google Apps Script: Instantly Rearrange Google Sheets Tabs Right to Left
For those considering improving googlesheets efficiency.
Those with many sheet tabs in one file.
Google Sheets is a very convenient tool, but a troublesome aspect is moving sheet tabs.
When there are many tabs, the basic method of moving them one by one can be time-consuming, especially when you want to move a tab from the far right to the far left. In such cases, you can use Google Apps Script to move them all at once.
If you need to repeatedly move sheet tabs to the far left, using Google Apps Script can make the process easier.
The script to move the selected sheet tab to the far left
// Move the selected sheet tab to the far left
function moveActiveSheetToLeft() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = spreadsheet.getActiveSheet();
spreadsheet.moveActiveSheet(1);
}
Here is the script to move the selected sheet tab to the far left.
You can easily copy the script by clicking the copy icon in the top right corner of the code block.
You can copy and use the script as it is.
Script to move the selected sheet tab to the far right
// Move the selected sheet tab to the far right
function moveActiveSheetToRight() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var totalSheets = spreadsheet.getNumSheets();
var activeSheet = spreadsheet.getActiveSheet();
spreadsheet.moveActiveSheet(totalSheets);
}
Here’s the script for moving the selected sheet to the far right, opposite to what we did earlier.
You can copy and use it as is.
How to Use the Script
- Toolbar – Extensions – Apps Script
- Paste the script
- Save the script
- Run
- The selected sheet tab moves to the left (right).
Open the spreadsheet, then click on “Extensions” in the toolbar and select “Apps Script.”
Since `function myFunction(){}` is already there at the beginning, delete it and paste the above script.
If you’re running the script for the first time, you need to authorize it.
Therefore, press “Review Permissions.“
Next, press “Advanced.”
Press “Go to Untitled project (Unsafe).”
After that, press “Allow.”
In the image above, “Sheet 5” has moved to the far left.
If there are only a few sheets, you can move them easily without using Apps Script, but when there are many, using Apps Script can save you time.
Basic Method for Moving Sheet Tabs (Without Using Google Apps Script)
Drag & Drop
Right-click Menu
- Drag & Drop
-
- Hover the cursor over the sheet tab you want to move.
- Click and hold the sheet tab with the mouse.
- Drag the sheet tab all the way to the left.
- Release the sheet tab.
- Right-click Menu
-
- Right-click on the sheet tab you want to move.
- Select “Move left” from the menu that appears.
When there are only a few sheet tabs, using drag and drop is an easy way to move them.
Summary
- When there are many sheet tabs, it’s easier to use Google Apps Script to move them to the far left.
- If there are only a few sheet tabs, it’s quicker to move them with drag and drop.
Move the sheet tab to the far left.
// Move the selected sheet tab to the far left
function moveActiveSheetToLeft() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = spreadsheet.getActiveSheet();
spreadsheet.moveActiveSheet(1);
}
シートタブを右端に移動させる
// Move the selected sheet tab to the far right
function moveActiveSheetToRight() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var totalSheets = spreadsheet.getNumSheets();
var activeSheet = spreadsheet.getActiveSheet();
spreadsheet.moveActiveSheet(totalSheets);
}
Please use this function when you have many sheet tabs.
-
Google Sheets
Enhance Productivity with Google Apps Script: Instantly Rearrange Google Sheets Tabs Right to Left
-
Google Sheets
How to Bulk Create Shortened URLs Using Google Sheets and Google Apps Script
-
Google Sheets
Streamline Your Workflow with Google Apps Script: Easily Transfer Gmail Content to Google Sheets
Our company offers support for improving work efficiency through the use of Google Apps Script.
If you need assistance with Google Apps Script customization or error resolution, please feel free to contact us.
We are fully committed to supporting your business improvements.
Contact us here
Comments