我的目的是将 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 导入向导。从那里,您可以调整导入设置并以正确的格式导入表格,然后保存。该表将有一个“源”脚本,按下该脚本后,将重新导入用新数据更新的表。这有助于实现您想要做的事情吗?