Come posso creare uno script JMP per importare più cartelle di lavoro di Excel da SharePoint?Ciao a tutti,
Ho diverse cartelle di lavoro Excel o365 archiviate in SharePoint che devo caricare su JMP e rinominare ogni tabella in base al nome file della cartella di lavoro Excel.
Ho trovato frammenti di codice dalla comunità JMP per aiutarmi, grazie a tutti!!
Il copione:
- hardcoded i nomi dei file e i percorsi di SharePoint
- apre il sito di SharePoint
- individua il file excel
- apre/importa il file Excel
Tuttavia ci sono 2 problemi.I nomi delle tabelle JMP non vengono rinominati e vengono visualizzate finestre popup modali che vorrei chiudere utilizzando lo script.
Allego i dati di Big Class formattati come una cartella di lavoro di Excel che puoi caricare su SharePoint.In allegato anche lo script.Assicurati di modificare i percorsi codificati e i nomi dei file nel tuo sito di SharePoint.
Grazie!
Sceneggiatura:
//SharePoint path, copy link from SharePoint then delete everything after "?"
path = {"https://<<YOUR site="">>/Big%20Class.xlsx?", "https://<<YOUR site="">>/Big%20Class_2000.xlsx?"};
//SharePoint file, copy link from SharePoint then delete everything after "?" and add "download=1"
file = {"https://<<YOUR site="">>/Big%20Class.xlsx?download=1",
"https://<<YOUR site="">>/Big%20Class_2000.xlsx?download=1"};
Batch Interactive( 1 );
For( i = 1, i <= N Items( path ), i++, //loop for paths to excel workbooks
Web( path[i], JMP window );
For( i = 1, i <= N Items( file ), i++, //loop for excel files
dt = Open(
file[i],
Worksheets( "Big Class" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 2 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Replicated Spanned Headers( 0 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 ),
Multiple Series Stack( 0 ),
Import Cell Colors( 0 ),
Limit Column Detect( 0 ),
Column Separator String( "-" ),
),
"Invisible",
);
Window( "Web Browser" ) << close window; //closes the JMP web window
);
name = {"Big Class", "Big Class 2000"}; //change table names THIS IS NOT WORKING
For( i = 1, i <= N Items( name ), i++,
dt << Set Name( name[i] )
);
Batch Interactive( 0 );
);</YOUR></YOUR></YOUR></YOUR>
ScriptingRi: Come posso creare uno script JMP per importare più cartelle di lavoro Excel da SharePoint?L'aggiunta di dt = list() funziona.
Grazie!
Ri: Come posso creare uno script JMP per importare più cartelle di lavoro Excel da SharePoint?Sembra che tu stia assegnando tutte le tabelle alla stessa variabile, dt.Quella variabile può contenere solo un riferimento a una singola tabella alla volta.Invece, potresti creare dt un elenco e quindi lasciare che memorizzi i riferimenti a tutte le tabelle di dati.Ecco come potrebbe apparire (non testato).
//SharePoint path, copy link from SharePoint then delete everything after "?"
path = {"https://<<YOUR site="">>/Big%20Class.xlsx?", "https://<<YOUR site="">>/Big%20Class_2000.xlsx?"};
//SharePoint file, copy link from SharePoint then delete everything after "?" and add "download=1"
file = {"https://<<YOUR site="">>/Big%20Class.xlsx?download=1",
"https://<<YOUR site="">>/Big%20Class_2000.xlsx?download=1"};
Batch Interactive( 1 );
//Make an empty list to store references to all data tables
dt = list();
For( i = 1, i <= N Items( path ), i++, //loop for paths to excel workbooks
Web( path[i], JMP window );
For( i = 1, i <= N Items( file ), i++, //loop for excel files
dt[i] = Open(
file[i],
Worksheets( "Big Class" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 2 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Replicated Spanned Headers( 0 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 ),
Multiple Series Stack( 0 ),
Import Cell Colors( 0 ),
Limit Column Detect( 0 ),
Column Separator String( "-" ),
),
"Invisible",
);
Window( "Web Browser" ) << close window; //closes the JMP web window
);
name = {"Big Class", "Big Class 2000"}; //change table names THIS IS NOT WORKING
For( i = 1, i <= N Items( name ), i++,
dt[i] << Set Name( name[i] )
);
Batch Interactive( 0 );
);
</YOUR></YOUR></YOUR></YOUR>