我试图手动刮表信息从一个网站导入到一个Drupal网站。
这些数据的格式如下:
Opening Balances of Banks/Discount Houses 76991.16
Rediscounted Bills 0
Standing Lending Facility (Net) 0
Standing Deposit Facility (Net) 522078.9
Repo 0
Reverse Repo 0
OMO Sales/Under-Writing by MMDs 0
OMO Repayment 0将其粘贴到电子表格中,我可以创建一个CSV文件,用于导入Drupal。CSV产生的情况如下:
Opening Balances of Banks/Discount Houses,76991.16
,
Rediscounted Bills,0
,
Standing Lending Facility (Net),0
,
Standing Deposit Facility (Net),522078.9
,
Repo,0
,
Reverse Repo,0
,
OMO Sales/Under-Writing by MMDs,0
,
OMO Repayment,0我的问题是CSV是错的。第一列中的数据应该表示CSV的标题,这意味着它们应该列在CSV的第一行,而不是左边。接下来的行应该是作为标题中项的出现而导入的数据序列。
如何以正确的顺序生成CSV文件来解决我的问题?
有上百行数据要导入,因此手动方法是不可行的。
更新:两条完整记录:
Date Financial Data As At 5/8/2014
Opening Balances of Banks/Discount Houses 76991.16
Rediscounted Bills 0
Standing Lending Facility (Net) 0
Standing Deposit Facility (Net) 522078.9
Repo 0
Reverse Repo 0
OMO Sales/Under-Writing by MMDs 0
OMO Repayment 0
Primary Market Sales (e.g NTBs, FGN Bonds) 0
Primary Market Repayment 0
CRR (Debit/Credit) 0
Net Foreign Exchange Auction (WDAS) 0
Statutory Allocations (FAAC, VAT,etc) 0
Joint Venture Cash Call Payment 0
Net Clearing (Lagos/Abuja) 0
NDIC Premium (Debit/Credit) 0
Other Major (Debit/Credit) 0
Date Financial Data As At 5/7/2014
Opening Balances of Banks/Discount Houses 98357.49
Rediscounted Bills 0
Standing Lending Facility (Net) 475
Standing Deposit Facility (Net) 483157.7
Repo 0
Reverse Repo 0
OMO Sales/Under-Writing by MMDs 0
OMO Repayment 237451.43
Primary Market Sales (e.g NTBs, FGN Bonds) 157177.87
Primary Market Repayment 157057.31
CRR (Debit/Credit) 0
Net Foreign Exchange Auction (WDAS) 0
Statutory Allocations (FAAC, VAT,etc) 0
Joint Venture Cash Call Payment 0
Net Clearing (Lagos/Abuja) 0
NDIC Premium (Debit/Credit) 0
Other Major (Debit/Credit) 0发布于 2014-05-10 15:56:24
TextDistil会为你这么做的。(披露-我是作者)。假设您想要生成多个行,所描述的8列中的每一列,最简单的方法是:
注意:当将模式粘贴到TextDistil中时,不应包括引号。
5/8/2014,76991.16,0,0,522078.9,0,0,0,0,0,0,0,0,0,0,0,0,0 5/7/2014,98357.49,0,475,483157.7,0,0,0,237451.43,157177.87,157057.31,0,0,0,0,0,0,0
您可能会发现'all‘视图是有用的-它允许您同时看到最终的输出以及您正在添加的菜谱的输入和输出。
第一配方

第二配方

第三配方

最终配方

发布于 2014-05-10 15:14:03
CSV看起来很容易,但事实并非如此。想象一下,如果在你的第一列中间,你有一个逗号,然后砰的一声。
现在想象一下用两个逗号。
:-)
我不知道您要用什么语言来处理这个问题(可能是php),但是我认为您必须编写一些程序
这是因为HTML清楚地说明了单元格内的内容和不包含的内容。只需手动复制和粘贴就可以得到内容,但是没有格式化,您最终会遇到角箱的问题。
要想在PHP中获得好的CSV库,请看一下https://stackoverflow.com/questions/3087287/is-there-a-popular-and-or-robust-php-csv-library。
https://stackoverflow.com/questions/23582637
复制相似问题