![]() |
![]() |
We are currently migrating this forum over to our HelpSystems domain. Please post all new threads in our new HelpSystems Community Portal. |
![]() |
|
![]() |
AutoMate Discussion | ![]() |
help :
faq :
home
|
||
Latest News:
|
latest topics : statistics |
Topic Title: Copy data from file and paste to excel Topic Summary: Created On: 05/31/2012 08:13 AM Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
||||||||||
Hi, I have some .txt files that I want to paste to excel. The problem is that before I paste the data to excel, I want it to find the first empyt row.
|
||||||||||
|
||||||||||
![]() |
||||||||||
Hi Luiz,
Would it be possible to provide an example of what the .txt will look like and what you would like the result to be?
------------------------- ![]() Ricardo Castaneda | Principal Support Analyst AutoMate | Division of HelpSystems HelpSystems, LLC | T: +1.213.738.1700 |
||||||||||
|
||||||||||
![]() |
||||||||||
Hi,
Follow attached one example of .txt file... I want to insert each value in one columm of the excel...like for example: Customer : XXXX
XXXX goes to cell A1 10000 goes to cell B1
Next file that the Automate will import should see that cells A1 and B1 are not empyt and fill the new values on cell A2 and B2 and so on.
Thanks a lot for your support.
|
||||||||||
|
||||||||||
![]() |
||||||||||
Luiz Felipe,
you can set the cursor on the first empty row with keystrokes as below. The selected cell is then column A on the first empty row, and you can paste or type your data in there as in my example.
Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder) ------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
||||||||||
![]() |
||||||||||
Hello Jean, Thanks a lot for your great support...
|
||||||||||
|
||||||||||
![]() |
||||||||||
Using find with regular expressions to parse the header would do it as below, assuming the file is read into a variable
Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder) ------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
||||||||||
![]() |
||||||||||
sorry to ask you that so many questions Jean...I am unexperienced in Automate. If for example I have many TXT files in a folder with this same structure... Is that possible to load file by file on the hdr variable?
|
||||||||||
|
||||||||||
![]() |
||||||||||
Hi Jean, I could solve it by using this code:
<AMVARIABLE NAME="File_Name">C:\Vivo_Automate\Input Files</AMVARIABLE>
|
||||||||||
|
||||||||||
![]() |
||||||||||
Luiz,
your solution is quite correct. It relies on the fact that the quantity and customer data are in a fixed position. My earlier proposal with FINDTEXT and regexes was yielding the same result even if the file format changes slightly, or the length of the data is variable (I see you assume it is always 4, but I'm pretty sure it may vary, as in your sample the quantity is 10000). Also you better open the Excel before the loop, and close it after the loop end, so that it happens only once, and runs faster.
------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
||||||||||
![]() |
||||||||||
Thanks a lot for your advise Jean. I will follow this best practices!
In your code example, you set the file in a variable, but for example if I have different .txt files in the folder (with the same structure)...
|
||||||||||
|
||||||||||
![]() |
||||||||||
You just have to read the whole file (inside the loop) into the "hdr" variable.
Then the FINDTXT's will find the values from the "hdr" variable. Tell me if you need more. BTW, when you include task steps into a reply in the forum, use the "Reply" link, and in the message window, use the "Attach code" button. This way the code can be copied from that code window and pasted directly into the task builder. This also avoids some problems with some AML tags that may jeopardize the full message.
------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
||||||||||
![]() |
||||||||||
Great... It is working now!! The problem was solved.
|
||||||||||
|
||||||||||
![]() |
||||||||||
You're welcome, Luiz
------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
AutoMate Discussion
» AUTOMATE » AutoMate 7
»
Copy data from file and paste to excel
|
![]() |
FuseTalk Enterprise Edition v4.0 - © 1999-2021 FuseTalk Inc. All rights reserved.