简体   繁体   English

将 EXCEL 中的特定单元格复制并粘贴到特定的 SPSS 单元格中

[英]copy and paste specific cells from EXCEL into specific SPSS cells

I am trying to copy data from excel into SPSS.我正在尝试将 excel 中的数据复制到 SPSS 中。 I have 80 excel files and need to copy and paste the same cells from each workbook into my main SPSS database.我有 80 个 excel 文件,需要将每个工作簿中的相同单元格复制并粘贴到我的主 SPSS 数据库中。 Is there any way I can do this aside from manually copying and pasting each individual value?除了手动复制和粘贴每个单独的值之外,我还有什么方法可以做到这一点?

Another approach if you have at least SPSS Statistics 17 would be to use the SPSSINC PROCESS FILES extension command available from the SPSS Community website (www.ibm.com/developerworks/spssdevcentral).如果您至少有 SPSS Statistics 17,另一种方法是使用 SPSS 社区网站 (www.ibm.com/developerworks/spssdevcentral) 上提供的 SPSSINC PROCESS FILES 扩展命令。 This can loop over a set of files and apply SPSS syntax to each, including GET DATA to read the files.这可以遍历一组文件并对每个文件应用 SPSS 语法,包括 GET DATA 来读取文件。 So it could read through the Excel files you want, open them in SPSS Statistics, and then select out whatever portion of the dataset is appropriate.因此它可以读取您想要的 Excel 文件,在 SPSS Statistics 中打开它们,然后 select 读取数据集的任何适当部分。

This requires the Python Essentials/plugin for your Statistics version also available from the Community website, but no skills other than with SPSS syntax are required.这需要您的 Statistics 版本的 Python Essentials/plugin 也可从社区网站获得,但除了 SPSS 语法之外不需要其他技能。

HTH, Jon Peck HTH,乔恩·派克

I use SPSS at my work, and we import data from excel on a daily basis.我在工作中使用 SPSS,我们每天从 excel 导入数据。 We do a save-as to tab delimited text format, and use a SPSS Syntax script to import the text files.我们执行另存为制表符分隔的文本格式,并使用 SPSS Syntax脚本导入文本文件。 Since you have so many excel files you could automate the whole "save-as" process with some vba if that would make things easier.既然你有这么多 excel 文件,你可以用一些 vba 自动化整个“另存为”过程,如果这会让事情变得更容易的话。

UPDATE更新

Here is a small bit of code to loop through (Excel) files in a directory, open each one, then save as a tab delimited text file.这是一小段代码,用于遍历目录中的(Excel)文件,打开每个文件,然后另存为制表符分隔的文本文件。 Change the .xls designation if your files are.如果您的文件是,请更改.xls名称。 xlsx or .xlsm , also you'll want to change the folder paths to something meaningful... xlsx.xlsm ,您还需要将文件夹路径更改为有意义的...

Sub TestMe()
Dim wb As Workbook
Dim INfldr As String
Dim OUTfldr as String

OUTfldr = "C:\WhereIPutStuff\"
INfldr = "C:\WhereIKeepStuff\"
strFNAME = Dir(INfldr & "*.xls")

i = 1

Do
Set wb = Application.Workbooks.Open(INfldr & strFNAME)
wb.SaveAs Filename:=OUTfldr & "OutputFile(" & i & ").txt", _
          FileFormat:=xlText, _
          CreateBackup:=False

wb.Close False

i = i + 1  
strFNAME = Dir
Loop Until strFNAME = ""

End Sub

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从特定范围复制和粘贴非空单元格 - Copy and paste not empty cells from a specific range VBA Excel基于IF语句自动复制和粘贴特定单元格 - VBA Excel Automatically Copy & Paste Specific cells based on IF statement Excel VBA从选定的行复制特定的单元格并将指定的列粘贴到其他工作簿 - Excel VBA copy specific cells from selected rows and paste specified column other workbook 将特定单元格从一个工作表复制并粘贴到另一个工作表 - Copy and Paste Specific Cells from one worksheet to another 如何复制特定的单元格并将其粘贴到新工作簿 - How to copy specific cells and paste to a new workbook 如何复制特定单元格,然后将它们粘贴到指定的单元格 - How to copy specific cells, and then paste them to assigned cells 如何根据工作表2中单元格的值从工作表1中复制特定单元格并将其粘贴到工作表2的相应行中? - How do I copy specific cells from sheet 1 and paste into corresponding rows of sheet 2 , based on values of cells in sheet 2? 从一行复制特定的单元格,然后粘贴到另一工作表的不同单元格中 - Copy specific cells from one row and paste into different cells on another worksheet 根据行数据复制特定的单元格并粘贴在特定的工作表上 - Copy specific cells according to row data and paste on specific sheet Excel宏:将特定的单元格从多个工作表复制到单独的工作表中的特定单元格 - Excel Macro: Copy specific cells from multiple sheets to specific cells in separate sheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM