Mosses

Export data to Excel using AUTOIT

40 posts in this topic

Hi I am Mosses I am new to AutoIt scripting...

I want to copy or read data from one windows application and paste or export the value to excel.

Can anyone help me with this

 

 

Share this post


Link to post
Share on other sites



Welcome to the forum. I can point you to the right direction. Check the help file - there are a lot of examples there.
 For excel you will need to check the _Excel UDF and functions. For the other part - it depends of the windows application.
 You will have to give more details.

Share this post


Link to post
Share on other sites

Thank you Juvigy.... It was helpful for me

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi can I assign send("^c") and send("^v") to a variable...???

Below is my code I am assigning to a variable but I am getting value "1"

Local $dtValue = send("^v")

Is this the right or correct way of doing can anyone help me on this..

Thanks in advace...

 

Edited by Mosses

Share this post


Link to post
Share on other sites

Calling the function Send just returns true. You can assign the function call Send to a variable but you need to supply the parameters, or you can create a wrapper that does Send("^c or v") and assign that function call to a variable.

Global $send = Send
Global $send_ctrl_v = SendCtrlV
GLobal $send_ctrl_c = SendCtrlC

$send("^c")
$send("^v")

$send_ctrl_c()
$send_ctrl_v()

Func SendCtrlV()
    ConsoleWrite("SendCtrlV() Called" & @LF)
    Send("^v")
EndFunc

Func SendCtrlC()
    ConsoleWrite("SendCtrlC() Called" & @LF)
    Send("^c")
EndFunc

Why do you want to use Send? There may be a more efficient way to do what you want without using Send.

Good rule of thumb, if you can avoid using Send and MouseClick/MouseMove, do it.

Share this post


Link to post
Share on other sites

Thanks for your quick reply Inuno Taishou.. 

I will try this...

Share this post


Link to post
Share on other sites

Hi Inuno Taishou... I tried the above provided script..

I am still getting Boolean value...

Thanks

 

Share this post


Link to post
Share on other sites

What version of autoit are you using? That script executes and calls the corresponding functions and writes the call to the console for me

Share this post


Link to post
Share on other sites

I am using version 3.5.4

What I want to do is copy few data from an Windows Tool and paste it in a new excel....

 

Share this post


Link to post
Share on other sites

What about using the _Excel_RangeCopyPaste UDF instead?

Share this post


Link to post
Share on other sites
1 minute ago, InunoTaishou said:

What about using the _Excel_RangeCopyPaste UDF instead?

Thanks I will try with that

Share this post


Link to post
Share on other sites

Hi inuno I guess   _Excel_RangeCopyPaste UDF is used to copy and paste from Excel...

But in my case I copy from an 3rd party tool and paste it to an excel...

 

Thanks 

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Use ClipGet to retrieve text from the clipboard into a variable and then _Excel_RangeWrite to write the data to Excel.
If you need to copy formatted data then use _Excel_RangeCopyPaste to write data from the clipboard to Excel (see example 3 in the help file).

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

Hi Water Thanks a lots its working for me with ClipGet..... Thank you again

Share this post


Link to post
Share on other sites

Glad to be of service :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

Hi how to find the last row in excel...???

 

Share this post


Link to post
Share on other sites

Please have a look at the wiki.

$oRange = $oWorkbook.ActiveSheet.UsedRange.SpecialCells($xlCellTypeLastCell).Row

Returns the number of the last used row.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

$oExcel.ActiveSheet.UsedRange.Columns.Count

$oExcel.ActiveSheet.UsedRange.Rows.Count

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

NB:
The result of this two statements is only true when the used range starts at cell A1.
If the first touched cell is on another cell then the result might be misleading as UsedRange only puts the touched cells into account.
For details please see the wiki as mentioned above.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

Thanks Water for your quick reply 

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