Jump to content
Jess

Read data from excel using loop

Recommended Posts

Jess

Hi,

I am trying to do a simple task in which I have to read two columns with three rows. I need to read the two cell values for eg A1 and B1, calculate their sum using calculator and store the sum in C1. I have tried hard but not able to do it. Can you help me in that. I have tried using loop but I am not getting any positive result.

Thanks in advance.

Share this post


Link to post
Share on other sites
water

Why not let Excel do the job? Insert the formula into C1. 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Jess

Actually I am new to this Autoit and I have been assigned this task.

 

Share this post


Link to post
Share on other sites
Jess

Doing this job for a single row is easy but when there are two or more rows, it is not working. Please help me.

Share this post


Link to post
Share on other sites
water

Use _Excel_RangeWrite to write the formula to C1. Then use _Excel_RangeCopyPaste to copy C1 to all the other rows. 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

You are overcomplicating things. Why use Calculator to add two values? Just do it in Excel (script incomplete):

_Excel_RangeWrite($oWorkbook, Default, "=SUM(A1:B1)", "C1", False) ; Write the formula to C1
_Excel_RangeCopyPaste($oWorksheet, "C1", "C2:C3") ; Copy the formula to C2 and C3

 

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


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

×