我的目的是將 JMP 數據錶鍊接到 Excel 電子表格。 當 Excel 用戶填充電子表格時,我希望數據表能夠使用新數據自動重新填充(打開時或打開時持續)。 我希望消除每次重新復制新數據的需要,消除任何復制錯誤的風險並最終驗證總體。這可能嗎?如果可能,這是如何執行的?
我對腳本編寫不熟悉;任何幫助編寫腳本或指向其他博客的幫助都將不勝感激。
此致,
傑夫
這正是我想要執行的。我對腳本編寫不熟悉。我們可以談談這個嗎?
謝謝你,
傑夫
補充哈德利所寫的內容。 如果我理解您的需求,您確實希望使用 Excel 工作表中的新數據更新相同的 JMP 數據表,而不僅僅是從新的 Excel 工作表創建新表。 如果後者是正確的,哈德利是對的,這將是最簡單的方法,使用自動生成的導入腳本,並在每次想要獲取新數據(在新數據表中)時重新運行它。
如果這是我相信您最終想要實現的目標,這可能會有所幫助:
Names default to here(1);
// Excel Sheet you get the new data from
excelFile = "Wetterdaten.xlsx";
// current data table - which has data from an earlier time point of the Excel file
cdt = Current Data Table();
// get the name of the JMP table and the current number of rows
cdtName = cdt << get name();
n_Rows = NRows();
// use the import script used when importing the Excel file the first time
// you need to adjust this if the Excel file will be changed in the structure or other columns have been added or placed to other positions.
dtHelp = Open(
excelFile,
Worksheets( {eval(cdtName)} ),
Use for all sheets( 1 ),
Concatenate Worksheets( 1 ),
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+ n_Rows ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 )
), Invisible
);
// Now just concatenate the JMP Table with the new imported data - but only with the data after the number of rows from the current JMP table.
cdt << Concatenate (dtHelp, Append to first table);
// delete helping table
Close(dtHelp);
附件是一個 zip 文件,其中包含使用一些天氣數據和導入數據的完整示例,兩者都包含此腳本,您可以運行該腳本,然後該腳本將調用 excel 文件、抓取數據並將其添加到打開的數據表中。 還有一個文件再次解釋了它(不幸的是用德語,但在線翻譯器應該做得很好,我幾年前創建了這個)。
好處是您在數據表中所做的所有更改(例如“舊”數據的質量檢查)將持續存在,並且新的公式列也將適用於新數據。
啊,Excel 表又多了一條註釋。 如果您更改已導入的 Excel 工作表數據(也稱為行號 = JMP 表中的行數之後),這些更改將不會在數據表中更新,因為我們只導入或更好地說在當前行之後添加行。
你好,
最簡單的方法可能是將 Excel 文件拖到打開的 JMP 窗口中,這將打開 Excel 導入嚮導。從那裡,您可以調整導入設置並以正確的格式導入表格,然後保存。該表將有一個“源”腳本,按下該腳本後,將重新導入用新數據更新的表。這有助於實現您想要做的事情嗎?