Jump to content

Reading from Excel


Recommended Posts

I have an excel file that has basically two categories- "Item" and "Quantity". I'd like to make a script that will get the quantity from that excel document and that I can change in my script (using GuiCtrlCreateInput ) and save back to the document. I found an excel udf but that seems more for manipulating open excel worksheets. I'd like to not ever mess with excel, but rather use a gui interface I create.

How can I do this? Or should I use some other way to keep track of this inventory? Maybe I could do it in Access but then the same question arrises. I've played around with my gui to get it to kind of look the way I want but not of the real meat of the programming is done so I'm open to any kind of suggestions you might have. Thanks

-Muncher

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

In it's most simple form, excel is nothing but a text file. If you are only ever going to be using two values I would suggest looking at an INI file.

Item=quantity

you could then use INIRead and INIwrite to create all your values.

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

I can't give you a good answer for using access, but I really do suggest using the excel UDF. You only have to open the excel file (can be hidden, and done in read only mode) with the excel UDF, read it (either the entire sheet into an array, or a particular cell, however you want) then you can close the file if you really want to, and reopen it to apply and save the changes.

You really could just leave the excel file open and invisible, or use the attach function to use an already open spreadsheet.

I know you said you would prefer not to 'mess' with excel, but I think your getting the wrong impression of how cleanly interacting with it can go.

Hope this helps

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

Kerros,

Thanks for the suggestion. I've used INIRead and INIWrite before so I know how usefule that can be, however I'm not sure if I'll only have those two fields in the future. Actually, now that I think about it there will be more because I'll have different classifications too. I was just throwing up a simplified idea of what I wanted to do.

Someone,

I see your point. I think I might mess around with that and see how it goes. I know what I will eventually want is bigger than what I'm asking for here but I need a starting place so I guess this is as good as any. My current inventory has about 10,000 items in it right now so I just want to get some simple testing done, ya know?

Thanks to both of you for the quick responses and ideas!

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

I would have to agree that 10,000 is a bit large for an INI file.

Check out this Excel UDF... it seems to work the best for me.

Edited by Kerros

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

Sorry about the link, not sure what happened there.

Yes, that the one that I use. It should be fairly simple to do what you are looking for with that UDF.

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...