Excel Function Library for AutoHotkey: 89 v2 Functions, No VBA

Excel Function Library for AutoHotkeyEver spent an afternoon in Excel doing the same clicks over and over?

Bold the header. Freeze the top row. Sort by column B. Delete the blank rows. Save. Next file.

You could learn VBA. Or embed macros in every workbook. Or…

You could drive Excel straight from AutoHotkey, from outside the workbook, with no macros at all.

How about you? What’s the one Excel chore you’d love to never do by hand again?

That’s what the Excel Function Library is for. 😊

89 Excel Functions, One #Include


It’s a library of ready-made functions for automating Excel with AutoHotkey.

You get 89 functions in the v2 version and 105 in the v1 version. One line each, instead of digging through Excel’s object model.

Here’s a taste of what’s in there:

  • Connect: grab the Excel that’s already open, or start a new one, open, save, and close workbooks
  • Format: fonts, colors, bold, borders, shading, number formats, column widths, freeze panes
  • Clean up: delete blank rows and columns, remove duplicates, search and replace, clear #NULL! errors
  • Sort and filter: sort by one or two columns, turn on filters, filter a column
  • Look things up: VLOOKUP, find a value and get its position, find header columns
  • Tables and sheets: create and filter tables, add and select worksheets, move rows and columns
  • Links and email: add hyperlinks and clickable email links, pull hyperlinks out of a sheet
  • Get data out: copy a range to the clipboard, or into an AutoHotkey Object or Map

Bold and Sort a Sheet in 4 Lines


Grab the Excel window you already have open, bold the header row, and sort by column B:

#Include XL.ahk
XL := XL_Handle(1)                 ; the Excel that's already open
XL_Format_Format(XL, "A1:D1", 1)  ; bold the header row
XL_Sort_UsedRange(XL, 1, "B", "A") ; sort by column B, A to Z

No VBA. No macros saved in the workbook. Your coworkers’ files stay exactly as they were.

Works with what you have open. XL_Handle grabs the Excel window you’re already using, so your script picks up right where you are.

Learn It From the Excel Playlist


We’ve made a LOT of videos on automating Excel with AutoHotkey.

Start with the Excel playlist on YouTube, or browse our Excel and AutoHotkey page.

What’s in the Download


  • XL.ahk for AutoHotkey v2 (89 functions)
  • XL.ahk for AutoHotkey v1 (105 functions), for older scripts
  • Version 2.2.0 (updated 2025/01/22)
Requirements: Windows, Microsoft Excel, and AutoHotkey v2 (or v1).

Drop XL.ahk next to your script, or in your Lib folder, and #Include it.

Get the Excel Function Library


The Excel Function Library is $4.99. You get both the v1 and v2 versions.

One thing I’ve learned: the Excel job you do every week is the one most worth automating.

Pick one chore, automate it, and get that hour back every single week. ⚡

Joe

Joe Glines

Joe Glines spent 20 years as a corporate data scientist before going all in on automation. He now uses AI to build automation in AutoHotkey, Python and Rust, has made 1,500+ tutorials, and runs the-Automator with a small team that has shipped 450+ time-saving tools.

Comments are closed.