Excel to Variables to Web Form?

I have an Excel file that has multiple rows/columns, and I need to name the individual cells to variables, that I can then paste into a webform. For this, I've just had the macro paste into a TextEdit file so I can make sure that the information is correct. For the real version, I will be iterating through the webform fields and pasting the variables. I will have about 500 rows in the real world and about 10 columns of data, but have started here.

I've created the macro and get the variables. I'm sure that I created the macro in the most elementary way, so suggestions are appreciated to make it simpler. A couple questions: Is there a way to not have separate AppleScript to create each variable? And, if there is a number, can the variable be formatted as a non-scientific notation (I want the value of the variable 1010000114 to remain 1010000114, NOT 1.010000114E+9)

The Excel file is in the zip and here is the macro.
Excel to Webform .kmmacros (17.3 KB)

Metadata Entires-v3_for testing.xlsx.zip (11.1 KB)

@jdevaud I'm having the same issue with number variable being converted to scientific notation.

Did you find a way around this?

Hey Scott,

I suspect no one responded to Jacques' question, because of the complexity of what he posted.

When asking questions of this variety it's best to post the simplest possible test-case macro and spreadsheet.

The easier you make it for people to test your work the more likely you'll get timely and useful assistance.

Making it easy to quickly download, import, and test a macro is respectful of others time, and this ultimately benefits you.

Try this script and see what you get.

tell application "Microsoft Excel"
   tell active sheet
      set usedRangeFormulaList to formula of used range
   end tell
end tell

For more knowledgeable help with AppleScript I recommend the MacScripter Forum and the Late Night Software Forum (Script Debugger + AppleScript).

Take Care,
Chris

(Keyboard Maestro Moderator)

Hi there. It’s been a long time since I worked I that, and I think I just found another way to accomplish what I needed. I’m not actively working now and so I’m not using KM at the moment.

It's actually very easy, though totally unintuitive! You coerce the number to a unit of measurement -- any will do, I've used inches -- and get the text representation of that.

return 1.010000114E+9 as inches as text
--> "1010000114"

Here's a little demo, the last dialog showing you can still treat it as a number in KM and use it in calculations:

AS Long Num as Text.kmmacros (5.7 KB)

Image

2 Likes