0

I have an automated test which produces a csv with two columns of data. I have an excel file which I use to gather the results of all the runs in a worksheet.

I want to fully automate the process of updating the Excel file after each test run.

This is probably what I want to do:

1. Read the two columns from the CSV file
2. Paste the two columns in a worksheet in the excel file, in the first 
   empty column to the right of the existing block of columns.
3. Save the Excel file

EDIT:

Now i understand that i can do steps 1-3 using a macro. All that is left for me to figure out is how to launch the macro.

zr.
  • 7,528
  • 11
  • 50
  • 84
  • possible duplicate of [Generate Excel Spreadsheet from CSV (ASP.NET C#)](http://stackoverflow.com/questions/4184573/generate-excel-spreadsheet-from-csv-asp-net-c) – Neil Knight Jan 20 '11 at 15:16
  • How is my question a duplicate of your suggested link? – zr. Jan 20 '11 at 15:20

2 Answers2

1

You can read the csv and write to the Excel sheet with a single data provider, the OleDb provider. Here is an article on how to write to Excel, and here is one on how to read csv.

Chris B. Behrens
  • 6,255
  • 8
  • 45
  • 71
0

Once you write the macro, it should be in the macro list in Excel for that Excel document. You can bind the macro to a keystroke (like Alt-i, Alt-whatever) so that it runs when your press that key combination.

I've done this on a couple of similar projects where I need to import CSV files from other sources and put the data into an Excel sheet (or sheets)

DashTechnical
  • 442
  • 2
  • 13
  • But i still want the macro to be invoked automatically, without me having to do the keystroke. – zr. Jan 20 '11 at 16:15