将带有表格数据的 Excel 电子表格转换为 JSON 的最简单方法是什么? [英] What is the easiest way to convert an Excel spreadsheet with tabular data to JSON?

查看:25
本文介绍了将带有表格数据的 Excel 电子表格转换为 JSON 的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 Excel 或 Open Office 中另存为 *.xls 的电子表格数据转换为 *.json

  • 数据不敏感
  • 文件不是很大

解决方案

假设您的意思是最简单并且不一定要寻找以编程方式执行此操作的方法,您可以这样做:

  1. 添加(如果还没有)一行列音乐家";到电子表格.也就是说,如果您的列中有数据,例如:

    Rory Gallagher Guitar格里·麦卡沃伊·巴斯Rod de'Ath 鼓Lou Martin 键盘大金刚苏族自封半官跺脚

    注意:您可能想要添加音乐家"和仪器"在第 0 行(您可能需要在那里插入一行)

  2. 将文件另存为 CSV 文件.

  3. 将 CSV 文件的内容复制到剪贴板

  4. 转到 http://www.convertcsv.com/csv-to-json.htm

  5. 验证第一行是列名"复选框被选中

  6. 将 CSV 数据粘贴到内容区域

  7. 混合将 CSV 转换为 JSON";按钮

    有了上面显示的数据,您现在将拥有:

    <预><代码>[{音乐家":罗里·加拉格尔",乐器":吉他"},{音乐家":格里·麦卡沃伊",乐器":贝斯"},{音乐家":Rod D'Ath",乐器":鼓"},{《音乐家》:《卢·马丁》,仪器":键盘"}{《音乐家》:《大金刚苏》、《仪器》:《自聘半官方践踏者》}]

    对于这种简单/极简的数据,它可能不是必需的,但是对于大量数据,通过检查这些数据的畸变和异常情况,从长远来看,它可以为您节省时间和头痛.

  8. 去这里:http://jsonlint.com/

  9. 将 JSON 粘贴到内容区域

  10. 按验证"键按钮.

如果 JSON 是好的,您将看到有效 JSON";在下面的结果部分备注;如果没有,它会告诉您问题出在哪里,以便您可以修复它.

I want to convert spreadsheet data from Excel or Open Office saved as *.xls to *.json

  • Data is not sensitive
  • File is not very large

解决方案

Assuming you really mean easiest and are not necessarily looking for a way to do this programmatically, you can do this:

  1. Add, if not already there, a row of "column Musicians" to the spreadsheet. That is, if you have data in columns such as:

    Rory Gallagher      Guitar
    Gerry McAvoy        Bass
    Rod de'Ath          Drums
    Lou Martin          Keyboards
    Donkey Kong Sioux   Self-Appointed Semi-official Stomper
    

    Note: you might want to add "Musician" and "Instrument" in row 0 (you might have to insert a row there)

  2. Save the file as a CSV file.

  3. Copy the contents of the CSV file to the clipboard

  4. Go to http://www.convertcsv.com/csv-to-json.htm

  5. Verify that the "First row is column names" checkbox is checked

  6. Paste the CSV data into the content area

  7. Mash the "Convert CSV to JSON" button

    With the data shown above, you will now have:

    [
      {
        "MUSICIAN":"Rory Gallagher",
        "INSTRUMENT":"Guitar"
      },
      {
        "MUSICIAN":"Gerry McAvoy",
        "INSTRUMENT":"Bass"
      },
      {
        "MUSICIAN":"Rod D'Ath",
        "INSTRUMENT":"Drums"
      },
      {
        "MUSICIAN":"Lou Martin",
        "INSTRUMENT":"Keyboards"
      }
      {
        "MUSICIAN":"Donkey Kong Sioux",
        "INSTRUMENT":"Self-Appointed Semi-Official Stomper"
      }
    ]
    

    With this simple/minimalistic data, it's probably not required, but with large sets of data, it can save you time and headache in the proverbial long run by checking this data for aberrations and abnormalcy.

  8. Go here: http://jsonlint.com/

  9. Paste the JSON into the content area

  10. Pres the "Validate" button.

If the JSON is good, you will see a "Valid JSON" remark in the Results section below; if not, it will tell you where the problem[s] lie so that you can fix it/them.

这篇关于将带有表格数据的 Excel 电子表格转换为 JSON 的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆