When you say table 2, I assume you mean worksheet 2. If so, then you just need to get a handle to the other worksheet and read and write data using that handle instead of the handle to worksheet 1. You can get the handle of a worksheet with the SheetsItem function as seen on line 322. You would send in an item of 2 instead of one and store the new handle. Then write in the same way as in the WriteDataToExcel function, except starting with the other worksheet handle.
Best Regards,
Chris Matthews
Measurement Studio Support Manager