How about inputting into a spreadsheet?

Discussion, questions and support.
Post Reply
aparis99
Posts: 5
Joined: Nov 22nd, ’22, 04:57

Post by aparis99 » Dec 15th, ’22, 22:45

On the YouTube video showing how to query a spreadsheet, I asked if it was possible to do the opposite, and use prompts to enter data into an ever-growing spreadsheet. The reply was to contact support, so I thought I'd ask here in case others are curious.

I track various jobs I do in a spreadsheet with usual columns for Client, Address, etc, and think it would be nice to have a prompt to enter the data in, and it go and enter it into the spreadsheet automatically if possible.

May be another post altogether, but could utilize the same thing for entering appt's on Google Calendar (client, address).

Thanks!
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Dec 19th, ’22, 18:41

You could use the COM object to access Excel. For example this code (Type: Command) will ask for the input value and write it to cell E5 in the Excel file. Of course you can change the file path and the cell range as you wish.

Code: Select all

InputBox, CellValue, Input, Enter the value, , 200, 120
fn := "D:\MyFolder\Sales.xlsx"
tooltip Writing to Excel
oExcel := ComObjCreate("Excel.Application")
oWorkbook := oExcel.Workbooks.Open(fn)
oWorkbook.Sheets(1).Range("E5").Value := CellValue
oWorkbook.Save()
oExcel.Quit()
oExcel:=""
tooltip
Here is one of the tutorials to learn about Excel COM if you wish to develop it further.
https://www.autohotkey.com/board/topic/ ... for-excel/
Post Reply