简体   繁体   中英

How to export this excel spreadsheet in this format?

I have an excel spreadsheet with 875 rows and 6 columns .

How can I export all the data (possibly with vb script?) into a txt file like this..

row = 1

array(
'name'=>' column1data ',
'address'=>' column2data ',
'telephone'=>' column3data ',
'email'=>' column3data ',
'website'=>' column4data ',
'latitude'=>' column5data ',
'longitude'=>' 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. Side note, I forget at the moment if the single quotes will work in the formula above, you may have to escape them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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