Jump to content

Excel - Going through an Excel file line by line


Go to solution Solved by water,

Recommended Posts

Hi all, 

 

I was wondering if someone can help me out. 

For my ongoing project I need to automate work in a tool. I have figured most of it out. Originally the script is in AutoHotKey but for reasons AutoIt is better. 

There are several things I need to do in an Excel file. 

1. I need to check for the first empty cell - This to know up to where to process it. 

2. Check one cell with the one below it, in case they are the same, I will need to loop the process in the tool

3. I need to take column A value, paste it somewhere, run through a process, then depending on the result of 2, write column D in subsequent fields. 

Then following that I need to go to the next row. 

I have had a look at the _Excel_RangeRead function in the Excel.au3, but I am struggling to figure out how to make the range work with a variable. 

Any help would be greatly appreciated. 

Link to post
Share on other sites

Maybe this wiki page sheds some light onto the subject.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
21 hours ago, Nilkimas said:

I have had a look at the _Excel_RangeRead function in the Excel.au3, but I am struggling to figure out how to make the range work with a variable. 

Please post the code you used, the value of @error and @extended after after calling _Excel_RangeRead and the result you get (nothing, wrong result ...)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

I'm trying to find how to get the values contained within a cell... 

The wiki page has a lot of information on how to get the range, but I can't seem to find the way to get the content. 

In AutoHotKey I used the following: 
A2 := test.ActiveSheet.cells.(Line,2).FormulaR1C1 to format a variable based on the content to then write/paste elsewhere. 

Edited by Nilkimas
Link to post
Share on other sites
  • Solution

I do not know AutoHotKey but I think in AutoIt your statement should look like:

Global $vCellR1C1  ; Formula of the read cell
Global $oWorkbook  ; Object of the Excel workbook to process
Global $iLine      ; Line number to read
; AutoHotKey:test.ActiveSheet.cells.(Line,2).FormulaR1C1 
$vCellR1C1 = $oWorkbook.ActiveSheet.Cells($iLine,2).FormulaR1C1

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...