Get spreadsheet info

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 5448
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Get spreadsheet info

22 Feb 2018, 20:48

This should do it. It works on Internet Explorer. Cheers.

Code: Select all

q:: ;Internet Explorer - Google spreadsheet get text
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
;MsgBox, % oWB.document.getElementsByTagName("table").length

oTable := oWB.document.getElementsByTagName("table")[0]
oRows := oTable.rows
vOutput := ""
;MsgBox, % oRows.length

Loop % oRows.length
{
	oCells := oRows[A_Index-1].cells
	Loop, % oCells.length - 1
		vOutput .= oCells[A_Index-1].innerText "`t"
	vOutput .= oCells[oCells.length-1].innerText "`r`n"
}
MsgBox, % oTable.rows[2].cells[1].innerText
MsgBox, % oTable.rows[6].cells[2].innerText
oWB := oTable := oRows := oCells := ""
MsgBox, % Clipboard := vOutput
return

;e.g.
;Untitled spreadsheet
;https://docs.google.com/spreadsheets/d/1EbhS2g3AXw1_yqYmfM_iUzrv0y_sSTuXrvxFAvwe9SY/htmlview

;	A	B
;1
;2	g
;3
;4
;5
;6		o

Return to “Ask For Help”

Who is online

Users browsing this forum: au6, Bing [Bot], swagfag, vvhitevvizard and 37 guests