简体   繁体   English

将数据从记事本/ Excel文件复制到Excel文件“按列排列”

[英]Copy Data from Notepad/ Excel file to Excel file“Column wise”

i want to copy my data from Notepad/Excel file to Excel file "Column wise". 我想将我的数据从记事本/ Excel文件复制到Excel文件“ Column wise”。

I have my data like 我的数据像

  • A1:HELLO NIKI A1:HELLO NIKI
  • A2:POBOX 930, PH 9022 A2:POBOX 930,PH 9022
  • A3: A3:
  • A4:KDSFH DS SDF SDF A4:KDSFH DS SDF SDF
  • A5:@HY (DSD) A5:@HY (DSD)

Now i want this data as 现在我想要这个数据

  • A1:HELLO NIKI A1:HELLO NIKI
  • B1:POBOX 930, PH 9022 B1:POBOX 930,PH 9022
  • C1: C1:
  • A2:KDSFH DS SDF SDF A2:KDSFH DS SDF SDF
  • B2:@HY (DSD) B2:@HY (DSD)

Note:After three column it will break and start from second line 注意:三列后,它将中断并从第二行开始

I have around 3000 lines, stored in excel/notepad file. 我大约有3000行,存储在excel / notepad文件中。 It is not possible to copy/paste all data, so Please suggest. 无法复制/粘贴所有数据,因此请提出建议。 I know PHP very well so if is there any way using PHP. 我非常了解PHP,因此是否可以使用PHP。 please suggest first. 请先提出建议。

My Codes Are:- 我的代码是:-

<?php
$name=$_REQUEST['name'];
$export=$_REQUEST['export'];
$t=$_REQUEST['t'];
if($_REQUEST['go'])
{
$fo=fopen($name,"r");
$fr=fgets($fo);
$fe=fopen($export,"w");
fwrite($fe,$fr);
echo"Data succesfully Inserted";
}
?>
<form>
Enter flie name<input type="text" name="name" /><br />
Enter Export flie name<input type="text" name="export" /><br />
<input type="submit" name="go" value="Go" />    

Excel可以直接打开CSV文件,因此只需将数据重新写入另一个文件,以逗号分隔,并在每三个项目后插入一个换行符。

copy your data into A1 on Sheet1 将数据复制到Sheet1的A1中

Use this formula in Sheet2, starting at A1, copied to the range you want it to fill (eg A1:C1000) 在Sheet2中使用此公式,从A1开始,复制到您要填充的范围内(例如A1:C1000)

=OFFSET(Sheet1!$A$1,((ROW()-1)*3)+COLUMN()-1,0)

once you start seeing 0 's, the data has been copied. 一旦您开始看到0 ,就已经复制了数据。

Once you have all the data formatted, then highlight columns A,B, and C in Sheet2, Copy and then Paste as values, then you can delete to original data. 格式化所有数据后,突出显示Sheet2中的A,B和C列,然后复制并粘贴为值,然后可以删除为原始数据。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM