Copy text from one work sheet to another

 Tannu -
Hello, Could some one help explain how I can simply copy text from a cell in a different work sheet. I'm trying to make a report using the months of the year. As the rolling performance indicators more on I need to have a cell look for the month in another work sheet and fill in the blanks. i.e. I have worksheet1 with cell A2 needing to be populated, I habe work sheet 2 with the data. Could someone help me understand What is required.

Many Thanks in advance.

2 replies

In sheet1 cell A2 if sheet2 cell A4 has the data:

Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Registration date
Friday May 22, 2009
Last seen
February 2, 2010
Hello meljam

If you want to do this automatically without manually opening the spreadsheet program, you can write a script for that. Save the files as CSV (Comma Separated Values) or TSV (Tab Separated Values). Excel will work with both. I will assume TSV.

Here, then, is the synopsis of the problem. We want to copy cell A2 (second row, first column) from C:/file1.csv to C:/file2.csv.

# Script A2.txt
# Read file1.
var str content1 ; cat "C:/file1.csv" > $content1
# Get second row of content1.
var str row2 ; lex -e "2" $content1 > $row2
# Get first column of row2.
var str column1 ; wex -e "1" $row2 > $column1
# We now have the value of cell A2 in $column1. Read file2.
var str content2 ; cat "C:/file2.csv" > $content2
# Extract the first row of content2 unchanged into output.
var str output ; lex -e "1]" $content 2 > $output
# Put in the extracted value of cell A2.
echo "\n" $column1 "\t" >> $output
# Put in the rest of data from content2.
wex -e "[2" $content2 >> $output
# Output is ready. Write it back to file2.
echo $output > "C:/file2.csv"
# Done.

Script is in biterscripting ( ) . To try, save the script as C:/Scripts/A2.txt, start biterscripting, enter the following command.

script A2.txt

The script can also be called from the task scheduler, if you want to schedule a monthly task. I am calling the script A2 because, we want to extract cell A2 here. But, you can change the script to extract any other cell, or even multiple cells.


Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!