AutoHotKey Excel - Grabbing data from excel with AHK

Published: 08 December 2020
on channel: TAB Nation - Automation
12,437
203

Here we will look at three ways to gather data from an excel file. And best part is you dont even have to have excel open to grab data.

CODE:
f9::
FilePath = X:\Desktop\ppl.xlsx"
oWorkbook := ComObjCreate("Excel.Application")
oWorkbook.Workbooks.open(FilePath,, readonly := true)
oWorkbook.Visible := 0
clientsname := oWorkbook.Worksheets("test doc").Range("A3").Value
StringRight, clientsname, clientsname, 5
clientsphone := oWorkbook.Worksheets("test doc").Range("B3").Value
clientsstate := oWorkbook.Worksheets("test doc").Range("C3").Value
clientsfax := oWorkbook.Worksheets("test doc").Range("D3").Value
Xl.Quit()

finalinfo=
(
load completed
Clients name is %clientsname%
Clients phone is %clientsphone%
Clients state is %clientsstate%
Clients fax is %clientsfax%
)
msgbox, %finalinfo%
return

f10::
vararr=0
{
xcl := ComObjActive("Excel.Application")
reminderList := []
loop
{
bodyText := xcl.Range("A" . A_Index + 1).value
vararr++
varsavedname%vararr%=%bodyText%
if (bodyText = "")
break
}
Msgbox, Load completed row 4 info is %varsavedname3% ---- Final row is %vararr%
}
Return

f11::
{
vararr=0
xcl := ComObjActive("Excel.Application")
reminderList := []
loop
{
bodyText := xcl.Range("A" . A_Index + 1).value
vararr++
varsavedname%vararr%=%bodyText%
if (bodyText = "12345 Thom")
break
}

oWorkbook := ComObjCreate("Excel.Application")
oWorkbook.Workbooks.open(FilePath,, readonly := true)
oWorkbook.Visible := 0
Xl.Quit()

vararr++
Msgbox, Thom found at line %vararr%
}
Return


Watch video AutoHotKey Excel - Grabbing data from excel with AHK online, duration hours minute second in high quality that is uploaded to the channel TAB Nation - Automation 08 December 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 12,437 times and liked it 203 visitors.