简体   繁体   English

如何以这种格式导出此Excel电子表格?

[英]How to export this excel spreadsheet in this format?

I have an excel spreadsheet with 875 rows and 6 columns . 我有一个875行和6列的Excel电子表格。

How can I export all the data (possibly with vb script?) into a txt file like this.. 我如何将所有数据(可能使用vb脚本导出)到这样的txt文件中。

row = 1 行= 1

array( 数组(
'name'=>' column1data ', '名称'=>' column1data ',
'address'=>' column2data ', '地址'=>' 列2数据 ',
'telephone'=>' column3data ', '电话'=>' column3data ',
'email'=>' column3data ', 'email'=>' column3data ',
'website'=>' column4data ', 'website'=>' column4data ',
'latitude'=>' column5data ', 'latitude'=>' column5data ',
'longitude'=>' column6data ' '经度'=>' column6data '
), ),

increment row number and repeat the above until the end of rows 增加行号并重复上述操作,直到行末

the easiest thing for you to do is to create a column in the spreadsheet with the following formula 最简单的操作是使用以下公式在电子表格中创建一列

="array(
'name'=>'"&A1&"',
'address'=>'"&B1&"',
'telephone'=>'"&C1&"',
'email'=>'"&D1&"',
'website'=>'"&E1&"',
'latitude'=>'"&F1&"',
'longitude'=>'"&G1&"'
),"

As you can see, the idea is basically to build up the string, say in column H, then just copy and paste your new information wherever you like. 如您所见,该想法基本上是建立字符串,例如在H列中,然后将新信息复制并粘贴到任何您喜欢的地方。 Side note, I forget at the moment if the single quotes will work in the formula above, you may have to escape them. 旁注,我现在忘记了如果单引号可以在上面的公式中使用,您可能必须将其转义。

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

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