Jump to content

Recommended Posts

Posted

Hi all,

I am trying to find way to convert words in notepad into excel table. like this:

Notepad:

a1

a2

a3

a4

b1

b2

b3

b4

c1

c2

c3

c4

Excel Table:

a1 a2 a3 a4

b1 b2 b3 b4

c1 c2 c3 c4

Is anybody out there how can give ideas for a solution?

Thx.

Posted

You can try formatting your text into a CSV file and open it up in excel.

Thanks a lot! I have tried your suggestion. But there's only one column in csv, how to convert into multi column ?

I know some excel udf, but unfamiliar with copy and paste in notepad. Do you know some function that can perform this copying and writing to excel job?

Thx.

Posted (edited)

CSV (Comma-Separated Values)

Every cell in the table is delimited by a comma. The text file is saved with file extension ".csv".

Sample Text:

Header1,Header2,Header2
Value1,Value2,Value3
ValueA,,ValueB

You can use FileOpen and FileClose to open and save files. You can use FileWrite or FileWriteLine to write to a file.

Edited by omikron48
Posted

or you can use

#include "array.au3"
#include "excel.au3"
$var = ControlGetText("[CLASS:Notepad]", "", "Edit1") ;has to exist with >=16 Lines text
$sLines=StringSplit($var,@CRLF,1)
_ArrayDisplay($sLines)
$oExcel = ObjGet("","Excel.Application")    
$oExcel.Workbooks("test.xls").Activate  ;has to be open
_ExcelSheetActivate($oExcel, "Sheet1") ;has to exist

for $r =0 to 3
    for $c=0 to 3
        $x=_ExcelWriteCell($oExcel, $sLines[$r*4+$c+1],$r+1 ,$c+1)
        ;msgbox(0,"Text",$sLines[$r*4+$c+1])
    Next
Next

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...