excel通过宏来导出json数据
来源:互联网 发布:双面劳伦斯知乎 编辑:程序博客网 时间:2024/06/08 16:15
Sub 导出JSON() Dim s As String Dim FullName As String, rng As Range Dim row As Integer, column As Integer, maxrow As Integer Dim strContent As String Application.ScreenUpdating = False FullName = (ThisWorkbook.Path & "/" & Cells(1, 2) & ".txt") ' Cells(1, 2) 表示第1行,第二列的内容 '配置区域 proline = 5 '程序名定义行 begindatalen = 6 '数据起始行 row = ActiveSheet.UsedRange.Rows.Count '最大行 column = ActiveSheet.UsedRange.Columns.Count '最大列 strContent = "{" & """" & Cells(1, 2) & """" & ":[" 'json组成部分 For m = begindatalen To row If Cells(m, 1) <> "" Then strContent = strContent & "{" For n = 1 To column If n = column Then strContent = strContent & """" & Cells(proline, n) & """" & ":" & """" & Cells(m, n) & """" Else strContent = strContent & """" & Cells(proline, n) & """" & ":" & """" & Cells(m, n) & """" & "," End If Next n If m = row Then strContent = strContent & "}" Else strContent = strContent & "}," End If End If Next m strContent = strContent & "]}" WriteUTF8File strContent, FullName, False Application.ScreenUpdating = True MsgBox "数据已导出"End Sub
PS:在excel中插入一个宏安钮,然后编辑该宏代码即可。
0 0
- excel通过宏来导出json数据
- Json数据导出Excel(IE10支持)
- DataTable通过Repeater导出Excel没数据
- 通过excel导入导出oracle中数据
- C# 通过NPOI导入导出数据EXCEL
- 使用poi通过excel模板导出excel数据
- nodejs:Excel导出json
- 前端 json 导出 excel
- excel前台导出json
- 通过DataSet导出Excel
- 通过DataSet导出Excel .
- 通过DataTable导出Excel
- 通过OLE将ListView数据导出到Excel
- 向EXCEL导出数据(通过定义单元格区域名称)
- c# 通过流导出数据库数据,写进excel中
- C#通过OLEDB导出大数据到Excel
- NPOI 通过excel模板写入数据并导出
- JAVA通过JSP把数据导出到Excel
- Linux CentOS PhpMyAdmin安装
- 你站着编程两年身体会发生那些变化
- quetions 2013年12月19日23:00:56
- C#生成N位不重复随机数
- YII框架时间控件的使用
- excel通过宏来导出json数据
- Ubuntu下安装samba
- vi 命令用法
- Valgrind 之 Cachegrind 调研报告
- 机器学习其实比你想的更简单
- 追踪Drill的最新进展
- JQuery的$(document).ready(function(){})与JS的window.onload 的各自优势!
- SQL数据库三范式
- 【10.2移动新特性】GraphicsLayer新增动态模式,性能极大提升!