Copy txt file into excel vbscript


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Copy txt file into excel vbscript
# 1  
Old 08-03-2018
Copy txt file into excel vbscript

Hi everybody,

I am working on Windows 10 and using cygwin.
I have a vbscript as follows:

Code:
Set objExcel = CreateObject("Excel.Application")  
objExcel.Visible = True  
Set wb1 = objExcel.Workbooks.open("\\files\share\path\file1.xlsx") 
wb1.Worksheets("Sheet1").Range("A1:CR89").Clear
Set wb2 = objExcel.Workbooks.open("\\files\share\path\test.txt") 
wb2.Worksheets("test").usedrange.copy
wb1.Worksheets("Sheet1").usedrange.pastespecial
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo. >NUL  | clip", 0, True
wb2.Close
wb1.Save

I want at first to open file1.xlsx, delete cells in file1.xlsx, copy the content of the test.txt file inside file1.xlsx, and finally save and close file1.xlsx.

This script works, but I was wondering if there is a way to do the same task without having to open the test.txt file with excel? Something which would temporarily copy the content of test.txt without having this file opened.

Thanks in advance for any help.

Supernono06
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Copy the content from txt file and create a html file

I have a txt file with a list of error messages in a xml tag format, and each error message is separated with a identifier(endresult).Need to split that and copy and create a new html file.Error message has some special character. how to escape the special character and insert my data into the... (7 Replies)
Discussion started by: DevAakash
7 Replies

2. Shell Programming and Scripting

Copy data to CSV file from txt output

Hi Everyone , Below is output from a TL1 , I want just the NE Name: and beside that the Temperature and the voltages in a csv file , Is this possible? > act-user:AB1S2a:ArshadFO:493::**********; AB1S2a 2016-02-07 10:13:24 M 493 COMPLD "ArshadFO:2016-02-07 10-04-55,0" ;... (11 Replies)
Discussion started by: adgjmpt
11 Replies

3. Windows & DOS: Issues & Discussions

How to copy a file with long records ,i.e spanning to 2 or 3 lines from UNIX to excel?

Hi Experts, I have a Unix csv file which has long records ie the record length is more than 80 so it goes to the next line.So when its in unix though it spans to two or three lines it still counts it as one record. But what is happening is for the records that are long when i copy it into excel i... (0 Replies)
Discussion started by: 100bees
0 Replies

4. UNIX for Dummies Questions & Answers

How to copy a file opened in UNIX to word or txt?

Hi I would like to know how to copy a file opened in unix editor like Nedit or vi editor to a word document Since I am newbie I want to make sure I am not really copying onto real subdirectories I tried to right click and copy the entire .sql file or any other file opened.. Nedit doesn't... (3 Replies)
Discussion started by: swathi123
3 Replies

5. Shell Programming and Scripting

Copy Data from CSV file to Excel Sheet using Perl

Hi All, Firstly I will like to wish A Happy New Year to all. Now my issue is I have one csv file say(data.csv) and one excel file say(result.xls) The result.xls contains two sheet name Sheet1 and Sheet2, Now What I am trying to do is to First I want to delete that data of Sheet2 if present any,... (6 Replies)
Discussion started by: adisky123
6 Replies

6. Shell Programming and Scripting

Converting txt file to Excel file

Hi All, I have a text file with below content. TradeDate Name SecurityMnc ReasonDesc ======================================= 20120501 Robin ABC FO System Defect 20120502 Robin ABC FO System Defect I would want this in an excel file in 4 columns,... (3 Replies)
Discussion started by: robinbannis
3 Replies

7. Shell Programming and Scripting

Help with selecting column with awk for a txt file generated by excel

I am new to scripting/programming, so I apologize for any novice questions. I have a tab delimited text file that was saved from excel xls file. I am trying to select only the third column using awk command. My command line is as below: cat test.txt | awk '{print $3}' However, above... (8 Replies)
Discussion started by: SangLad
8 Replies

8. Windows & DOS: Issues & Discussions

Split Data in one column into 2 column in Excel using DOS or VBScript

Hi I have some data in my Excel File.However all the data is in one single column.I want to split it into two columns. Current Data: 1,Hi Everyone,I am 7,New To Dos,And 17,VB Script,i could 110,have tried this thing 1800,in UNIX Desired Output CELL1|CELL 2 1 |Hi... (3 Replies)
Discussion started by: dashing201
3 Replies

9. UNIX for Dummies Questions & Answers

Save Excel file as .txt in UNIX format

I have some files created in Excel that have to be saved as .txt files in order to load them into our accounting system. I can save the files as .txt files through Excel, but I then have to open them in TextPad and do a save as to change the Format from PC to UNIX. Is there a way to skip this step... (2 Replies)
Discussion started by: jroyalty
2 Replies

10. Shell Programming and Scripting

how to copy data to to excel file

Hi, Can any one tell me how to copy data using shell script to a excel file from text file to other columns of excel file,leaving first column unaffected i.e it should not overwrite data in first column. Say my text file data is: 15-dec-2008 15-dec-2009 16-dec-2008 16-dec-2009 ... (7 Replies)
Discussion started by: tucs_123
7 Replies
Login or Register to Ask a Question
GET_BROWSER(3)								 1							    GET_BROWSER(3)

get_browser - Tells what the user's browser is capable of

SYNOPSIS
mixed get_browser ([string $user_agent], [bool $return_array = false]) DESCRIPTION
Attempts to determine the capabilities of the user's browser, by looking up the browser's information in the browscap.ini file. PARAMETERS
o $user_agent - The User Agent to be analyzed. By default, the value of HTTP User-Agent header is used; however, you can alter this (i.e., look up another browser's info) by passing this parameter. You can bypass this parameter with a NULL value. o $return_array - If set to TRUE, this function will return an array instead of an object. RETURN VALUES
The information is returned in an object or an array which will contain various data elements representing, for instance, the browser's major and minor version numbers and ID string; TRUE/ FALSE values for features such as frames, JavaScript, and cookies; and so forth. The cookies value simply means that the browser itself is capable of accepting cookies and does not mean the user has enabled the browser to accept cookies or not. The only way to test if cookies are accepted is to set one with setcookie(3), reload, and check for the value. CHANGELOG
+--------+--------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+--------------------------------------------------+ | 4.3.2 | | | | | | | The optional parameter $return_array was added. | | | | +--------+--------------------------------------------------+ EXAMPLES
Example #1 Listing all information about the users browser <?php echo $_SERVER['HTTP_USER_AGENT'] . " "; $browser = get_browser(null, true); print_r($browser); ?> The above example will output something similar to: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3 Array ( [browser_name_regex] => ^mozilla/5.0 (windows; .; windows nt 5.1; .*rv:.*) gecko/.* firefox/0.9.*$ [browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9* [parent] => Firefox 0.9 [platform] => WinXP [browser] => Firefox [version] => 0.9 [majorver] => 0 [minorver] => 9 [cssversion] => 2 [frames] => 1 [iframes] => 1 [tables] => 1 [cookies] => 1 [backgroundsounds] => [vbscript] => [javascript] => 1 [javaapplets] => 1 [activexcontrols] => [cdf] => [aol] => [beta] => 1 [win16] => [crawler] => [stripper] => [wap] => [netclr] => ) NOTES
Note In order for this to work, your browscap configuration setting in php.ini must point to the correct location of the browscap.ini file on your system. browscap.ini is not bundled with PHP, but you may find an up-to-date php_browscap.ini file here. While browscap.ini contains information on many browsers, it relies on user updates to keep the database current. The format of the file is fairly self-explanatory. PHP Documentation Group GET_BROWSER(3)