根據實驗條件,我在不同資料夾下有兩種不同格式的 Excel 檔案的實驗結果。 有沒有辦法讓使用者指定父目錄,然後 JMP 將所有 Excel 檔案作為資料表開啟?
我還需要能夠根據文件的格式來聲明資料開始的行,以便列名正確。
我嘗試過使用工作流程,但無法將其用於超過 1 個文件,並且我嘗試過導入多個文件功能,但這僅允許訪問 1 個資料夾。
這是一個可以完成您想要的操作的開始腳本。它應該為您開發強大的腳本提供良好的開端。
Names Default To Here( 1 );
// Find the top directory to get the xlsx files from
path = Pick Directory();
// Read in all of the file names
allFiles = Files In Directory( path, recursive( 1 ) );
// Create a list of just the xlsx files
xlsxFiles = {};
For Each( {file}, allFiles,
If( Word( -1, file, "." ) == "xlsx",
Insert Into( xlsxFiles, file )
)
);
// Open each of the xlsx files one after another
// using the Excel Wizard
For Each( {file, i}, xlsxFiles,
Open( path || xlsxFiles[i], "excel wizard" )
);