Author |
Topic  |
|
zknauss
USA
72 Posts |
Posted - 07/08/2022 : 09:13:35 AM
|
OriginPro 2022b (64-bit) SR1 9.9.5.171 (Academic) windows 10 pro I am trying to develop a script that will use wappend to grab column B from every worksheet in a workbook and merge all the B columns onto a new sheet (this would be repeated for columns C-E). However, I'm running into several issues. 1. most of my data sets are very large taking 500-1000 sheets which is greater than the automatic script generator seems to be able to handle 2. the number of sheets is variable which won't work with a code that directly targets the name of each sheet. I'd also like to add into the code a workbook deleting script that once it is done appending the data will delete the workbook with all of the sheets. Thanks for any help with this below is an example code with what I have so far for the first 300 sheets.
wAppend -r 2 irng:=[SplitData1](ROI1!B,ROI2!B,ROI3!B,ROI4!B,ROI5!B,ROI6!B,ROI7!B,ROI8!B,ROI9!B,ROI10!B,ROI11!B,ROI12!B,ROI13!B,ROI14!B,ROI15!B,ROI16!B,ROI17!B,ROI18!B,ROI19!B,ROI20!B,ROI21!B,ROI22!B,ROI23!B,ROI24!B,ROI25!B,ROI26!B,ROI27!B,ROI28!B,ROI29!B,ROI30!B,ROI31!B,ROI32!B,ROI33!B,ROI34!B,ROI35!B,ROI36!B,ROI37!B,ROI38!B,ROI39!B,ROI40!B,ROI41!B,ROI42!B,ROI43!B,ROI44!B,ROI45!B,ROI46!B,ROI47!B,ROI48!B,ROI49!B,ROI50!B,ROI51!B,ROI52!B,ROI53!B,ROI54!B,ROI55!B,ROI56!B,ROI57!B,ROI58!B,ROI59!B,ROI60!B,ROI61!B,ROI62!B,ROI63!B,ROI64!B,ROI65!B,ROI66!B,ROI67!B,ROI68!B,ROI69!B,ROI70!B,ROI71!B,ROI72!B,ROI73!B,ROI74!B,ROI75!B,ROI76!B,ROI77!B,ROI78!B,ROI79!B,ROI80!B,ROI81!B,ROI82!B,ROI83!B,ROI84!B,ROI85!B,ROI86!B,ROI87!B,ROI88!B,ROI89!B,ROI90!B,ROI91!B,ROI92!B,ROI93!B,ROI94!B,ROI95!B,ROI96!B,ROI97!B,ROI98!B,ROI99!B,ROI100!B,ROI101!B,ROI102!B,ROI103!B,ROI104!B,ROI105!B,ROI106!B,ROI107!B,ROI108!B,ROI109!B,ROI110!B,ROI111!B,ROI112!B,ROI113!B,ROI114!B,ROI115!B,ROI116!B,ROI117!B,ROI118!B,ROI119!B,ROI120!B,ROI121!B,ROI122!B,ROI123!B,ROI124!B,ROI125!B,ROI126!B,ROI127!B,ROI128!B,ROI129!B,ROI130!B,ROI131!B,ROI132!B,ROI133!B,ROI134!B,ROI135!B,ROI136!B,ROI137!B,ROI138!B,ROI139!B,ROI140!B,ROI141!B,ROI142!B,ROI143!B,ROI144!B,ROI145!B,ROI146!B,ROI147!B,ROI148!B,ROI149!B,ROI150!B,ROI151!B,ROI152!B,ROI153!B,ROI154!B,ROI155!B,ROI156!B,ROI157!B,ROI158!B,ROI159!B,ROI160!B,ROI161!B,ROI162!B,ROI163!B,ROI164!B,ROI165!B,ROI166!B,ROI167!B,ROI168!B,ROI169!B,ROI170!B,ROI171!B,ROI172!B,ROI173!B,ROI174!B,ROI175!B,ROI176!B,ROI177!B,ROI178!B,ROI179!B,ROI180!B,ROI181!B,ROI182!B,ROI183!B,ROI184!B,ROI185!B,ROI186!B,ROI187!B,ROI188!B,ROI189!B,ROI190!B,ROI191!B,ROI192!B,ROI193!B,ROI194!B,ROI195!B,ROI196!B,ROI197!B,ROI198!B,ROI199!B,ROI200!B,ROI201!B,ROI202!B,ROI203!B,ROI204!B,ROI205!B,ROI206!B,ROI207!B,ROI208!B,ROI209!B,ROI210!B,ROI211!B,ROI212!B,ROI213!B,ROI214!B,ROI215!B,ROI216!B,ROI217!B,ROI218!B,ROI219!B,ROI220!B,ROI221!B,ROI222!B,ROI223!B,ROI224!B,ROI225!B,ROI226!B,ROI227!B,ROI228!B,ROI229!B,ROI230!B,ROI231!B,ROI232!B,ROI233!B,ROI234!B,ROI235!B,ROI236!B,ROI237!B,ROI238!B,ROI239!B,ROI240!B,ROI241!B,ROI242!B,ROI243!B,ROI244!B,ROI245!B,ROI246!B,ROI247!B,ROI248!B,ROI249!B,ROI250!B,ROI251!B,ROI252!B,ROI253!B,ROI254!B,ROI255!B,ROI256!B,ROI257!B,ROI258!B,ROI259!B,ROI260!B,ROI261!B,ROI262!B,ROI263!B,ROI264!B,ROI265!B,ROI266!B,ROI267!B,ROI268!B,ROI269!B,ROI270!B,ROI271!B,ROI272!B,ROI273!B,ROI274!B,ROI275!B,ROI276!B,ROI277!B,ROI278!B,ROI279!B,ROI280!B,ROI281!B,ROI282!B,ROI283!B,ROI284!B,ROI285!B,ROI286!B,ROI287!B,ROI288!B,ROI289!B,ROI290!B,ROI291!B,ROI292!B,ROI293!B,ROI294!B,ROI295!B,ROI296!B,ROI297!B,ROI298!B,ROI299!B,ROI300!B) method:=column id:=Sheet ow:=[NCONT1PeakDat]P_Height!;
ZTK |
|
YimingChen
1684 Posts |
Posted - 07/08/2022 : 2:10:28 PM
|
Instead of using the wAppend Xfunction, can you simply copy col(B) of all sheets to the target workbook? Try the script below. You can uncomment the last line to delete the source workbook.
String wbsource$ = %H;
newbook; // create the target workbook, book name is saved to string bkname$
win -o %(wbsource$) // Execute the script within the source workbook
{
int i = 1;
doc -e LW // loop all worksheets of the source workbook.
{
range r1 = [%(bkname$)]1!wcol(i);
range r2 = col(B);
r1 = r2;
i = i+1;
}
}
// window -c %(wbsource$);
James |
 |
|
|
Topic  |
|
|
|