05-03-26
Spreadsheet Column Copy Script
This Lua script for Rebind hardware input allows you to copy entire spreadsheet columns with a hotkey. It uses keyboard shortcuts to select and copy data, placing it in your clipboard for easy pasting
Question
Spreadsheet column copier on hotkey
Rebind AI
-- rebind: name=Spreadsheet Column Copier
-- rebind: description=Copy entire columns from spreadsheets with a hotkey
local cfg = UI.Schema({
copy_key = UI.Keybind("F9", { label = "Copy Column" }),
navigate_key = UI.Keybind("F10", { label = "Navigate to Top" }),
})
Bind(cfg.copy_key, Async(function()
-- Select from current cell to the end of the column
HID.Press("LCtrl+LShift+End")
Sleep(100)
-- Copy the selection
HID.Press("LCtrl+C")
Sleep(100)
UI.Notify("Column copied to clipboard", "success")
end))
Bind(cfg.navigate_key, Async(function()
-- Jump to the top of the column
HID.Press("LCtrl+Home")
Sleep(50)
UI.Notify("Moved to top", "info")
end))
function OnStop()
-- Clean up any clipboard operations
endHow it works
This script provides two hotkeys for spreadsheet column operations:
F9 (Copy Column): Selects from the current cell to the end of the column using Ctrl+Shift+End, then copies with Ctrl+C. The copied data is placed in your system clipboard, ready to paste anywhere.
F10 (Navigate to Top): Jumps to the top of the spreadsheet with Ctrl+Home, useful for repositioning after a copy operation.
Both operations use Async() to wrap the keyboard sequences in a coroutine, allowing Sleep() for timing between keypresses. The UI shows success/info notifications to confirm each action.
Customize the hotkeys in the UI panel, or adjust the selection logic if your spreadsheet application uses different navigation shortcuts (e.g., Excel vs Google Sheets vs LibreOffice Calc may have slight variations).
Learn more: