I'm wanting to populate an Excel sheet based off of variables in Keyboard Meastro.
For instance, I have a variable %logPath% that is a file path to a .txt file. I'd like to use this variable to build a file path that's used to link to it in Excel that looks something like this:
='/Users/user/Desktop/[logPath.txt]logPath'!$A$1
I have a few easy ideas to create the actual path but the part I'm drawing a blank on is how to input this variable into Excel to a specific location based on the log path (in row 1 if log path is 1, or in row 5 if log path is 5 etc.)
I spent a lot of today working with this as a basis and digging in, but I've grown fatigued with AppleScript's syntax in the process.
I tried to convert some of this into JXA as I'm more familiar with JavaScript syntax but yet I'm having a tough time finding any examples to piggy back off of and going through the library hasn't been fruitful for me in understanding how to go about utilizes the methods available.
Do you have an idea how I would do "set value of cell" in JXA?
I'll leave JXA to others, but AppleScript is quite easy. I've split the cell you want to add the formula to out to a variable so you can see how to use it in the command:
tell application "Microsoft Excel"
set cellRef to "B3"
set formula of range ("[Book1]Sheet1!" & cellRef) to "=B1+B2"
end tell
...and you can include your logPath variable in the "formula" string in the same way.
If you get stuck working that into whatever you already have, post the macro so we can see the terms extracted, variable names used, etc.