Jump to content

Automated Upload form with Excel data


Recommended Posts

I have a problem right now, I have an excel spreadsheet with about 180 lines of data that I need to enter into an online form with each line being a new page. This is housing data, with rental costs and that sort of thing.

I decided to use Autoit rather than do it manually so in the future I can automatically upload new housing lists automatically as well.

Now heres where I'm stuck. My internet explorer does not work so I can't use the IE.au3, so I will just automatically move the mouse cursor and enter data in Firefox the old fashioned way. This will work fine as soon as I can get the data to work.

I'm trying to use the ExcelCOM_UDF.au3 to read the data from the spreadsheet. The documentation is very vague and simply returns 0 for everything I try to do.

I was reading in the thread but its so old that the first pages I bothered looking through used functions that have been changed, renamed, and removed even.

I have a really simple task. Take one row at a time, starting at row two, and read columns A through U into my script.

Here is what I am trying, but its returning 0's. Probably something stupid, but an error would be nice...

#include <ExcelCOM_UDF.au3> 

$Book = _ExcelBookOpen(@DesktopDir & "\Houses Spreadsheet.xls", 0, "True")
; _ExcelBookOpen($sFilePath, $fVisible = 1, $fReadOnly = False, $sPassword = "", $sWritePassword = "")

$Cell = _ExcelReadCell($Book, "A", "2")
Msgbox(0, '', $Cell)
; _ExcelReadCell($oExcel, $sRangeOrRow, $iColumn = 1)
; _ExcelReadArray($oExcel, $iStartRow, $iStartColumn, $iNumCells, $iDirection = 0, $iIndexBase = 0)

Like this, I get an error "The requested action with this object has failed." According to the comment on ExcelReadCell, $RangeOrRow should be a string. The way I remember it, rows were horizontal, which are numbered in Excel. Columns were vertical, the lettered ones. So I dont know why $sRangeOrRow is a string and $iColumn is an integer.

If I change them around:

$Cell = _ExcelReadCell($Book, "A", "2")

The msgbox returns 0.

I am using Excel 2007. Any ideas?

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...