Jump to content
Menna

I need to copy data from excel sheet and past in desktop application

Recommended Posts

I need to create a script read values from excel sheet cell by cell then added in calculator 

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum!

What have you tried so far?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

i tried to copy list of values from excel sheet cell by cell and past it in another excelsheet 

Share this post


Link to post
Share on other sites
Posted (edited)

You did notice that AutoIt comes with an Excel UDF (library of User Defined Functions)?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

no i need a a simple from the code do copy from excel sheet cell by cell then past it in notebad 

Share this post


Link to post
Share on other sites

That's exactly what you can do with this UDF. Functions _Excel_RangeRead or _Excel_RangeCopyPaste should do what you want to do.
Have a look at the help file. There are a lot of examples too.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

i have create and find this example and still find an issue as the script looping 

#include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>


;Essentially i am trying to copy an excel cell, paste it somewhere go back to excel, go down a cell and repeat untill the cell is blank

Local $oExcel = _Excel_Open()
Local $sWorkbook = @ScriptDir & "\Book1.xls"
Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)

;Unsure if instead of using a cell range i should be getting excel to read one cell, then in the next loop add a 1 to the cell and read again. Eg. Read A1 do function, read A2 do function
Local $aResult = _Excel_RangeRead($oWorkbook,1, "A1:A14")

Do
   WinActivate("Microsoft Excel - Book1.xls")
   Send("{CTRLDOWN}c{CTRLUP}")
   ;Copy cell
   WinActivate("Untitled - Notepad")
   Send("{CTRLDOWN}v{CTRLUP}")
   ;Paste cell
   WinActivate("Microsoft Excel - Book1.xls")
   ;Go down a cell
   Send("{ENTER}{ENTER}")
Until $aResult = ""

Exit

Share this post


Link to post
Share on other sites
Posted (edited)

I suggest:

#include <Excel.au3>

Local $oExcel = _Excel_Open()
Local $sWorkbook = @ScriptDir & "\Book1.xls"
Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)
Local $aResult = _Excel_RangeRead($oWorkbook, 1, "A1:A14")

WinActivate("Untitled - Notepad")
For $i = 0 to UBound($aResult, 1) - 1
   Send($aResult[$i] & @CRLF)
Next
Exit

 

Edited by water
Added @CRLF so each value goes to a separate line

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks so much for your support but when when I'm tried i found that the result displayed all values in the same line and also i need to copy first item then make a manipulation once done will go to copy another one and so on 

image.thumb.png.a6e96833377926f2d99ec9985812c087.png

Edited by Menna

Share this post


Link to post
Share on other sites

I added a @CRLF to my script above so each value gooes to a seprate line.

What do you mean with "manipulation"? In the AutoIt script? In Notepad?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

i will add @CRLF 

i need to copy one value in cell then i will add to the application text box 

then i will click button in the application as submittion , and check the data displayed successfully in the application 

Then back to the sheet and copy the another cell so back to the app and submit the another one and so on 

Share this post


Link to post
Share on other sites

Then I suggest to use the following commands: ControlSend to send the data to your application, ControlClick to click the button and WinWait to wait until processing has ended.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

iam using a mouse click for controlclick , there is any solution becouse the application has no id for class name or instance :( ?

 

Share this post


Link to post
Share on other sites

It's hard to tell without knowing which application we are talking about.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - 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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...