Excel에서 Mongodb를 연결하는 방법
엑셀 매크로를 사용하여 mongodb 데이터베이스에 연결하고 싶은데, 이 작업을 수행하는 방법을 아는 사람이 있습니까?
셸 어프로치
셸을 사용하면 명령줄과 연결되는 거의 모든 것에 액세스할 수 있습니다.
실행 중인 MongoDB 인스턴스에 연결하여 쿼리를 즉시 창에 인쇄하는 베어본 예제입니다.다에대참추합야니다해가에 입니다.Windows Script Host Object Model.
Private Sub Test()
Dim wsh As New WshShell
Dim proc As WshExec
Dim line As String
Set proc = wsh.Exec("mongo")
With proc
.StdIn.WriteLine "use test"
.StdIn.WriteLine "db.restaurants.find({""address.zipcode"":""10075""})"
.StdIn.WriteLine "quit()"
Do While .Status = WshRunning
line = .StdOut.ReadLine
If line = "Type ""it"" for more" Then
.StdIn.WriteLine "it"
ElseIf line Like "{*" Then
Debug.Print line
End If
DoEvents
Loop
End With
End Sub
그러나 원시 JSON 문자열을 인쇄하는 것은 매우 흥미롭거나 유용하지 않습니다.JSON 파서를 직접 작성할 수도 있지만, 이 예에서는 팀 홀의 VBA-JSON을 사용합니다(GitHub에서 확인할 수 있습니다).
작성 시 MongoDB에서 반환된 문자열을 구문 분석하는 데 VBA-JSON을 사용할 때 해결해야 하는 한 가지 문제가 있습니다.값 " " " " " " ")"_id": ObjectId("...")오류가 발생합니다.이에 대한 빠르고 더러운 해결책은 ReGEx를 사용하여 파서의 문자열을 정리하는 것입니다.해야 할 입니다.Microsoft VBScript Regular Expressions 5.5라이브러리에서 다음 기능을 사용할 수 있습니다.
Private Function CleanString(str As String) As String
Dim temp As String
Dim rx As New RegExp
With rx
.IgnoreCase = True
.Global = True
.Pattern = "[a-z]*\(" ' Left
temp = .Replace(str, "")
.Pattern = "\)" ' Right
temp = .Replace(temp, "")
End With
CleanString = temp
End Function
를 MongoDB에 할 수 .Collection값에 액세스하는 것은 매우 간단합니다.
Private Sub Mongo()
Dim wsh As New WshShell
Dim proc As WshExec
Dim line As String
Dim response As New Collection
Dim json As Object
Set proc = wsh.Exec("mongo")
With proc
.StdIn.WriteLine "use test"
.StdIn.WriteLine "db.restaurants.find({""address.zipcode"":""10075""})"
.StdIn.WriteLine "quit()"
Do While .Status = WshRunning
line = .StdOut.ReadLine
If line = "Type ""it"" for more" Then
.StdIn.WriteLine "it"
ElseIf line Like "{*" Then
response.Add ParseJson(CleanString(line))
End If
DoEvents
Loop
End With
For Each json In response
Debug.Print json("name"), json("address")("street")
Next
End Sub
MongoDB 예제 데이터 세트에서 다음과 같은 출력을 생성합니다.
Nectar Coffee Shop Madison Avenue
Viand Cafe Madison Avenue
Don Filippo Restaurant Lexington Avenue
Lusardi'S Restaurant Second Avenue
Due Third Avenue
Lenox Hill Grill/Pizza Lexington Avenue
Quatorze Bistro East 79 Street
Luke'S Bar & Grill Third Avenue
Starbucks Coffee Lexington Avenue
New York Jr. League East 80 Street
Doc Watsons 2 Avenue
Serafina Fabulous Pizza Madison Avenue
Canyon Road Grill 1 Avenue
Sushi Of Gari East 78 Street
갓카스
ReadLine그리고.WriteLine차단 기능입니다.- 에 의해 열린
Exec숨길 수 없습니다.
의 두 방법은 접근 입니다. 는 위의두계은가 VBA음사용을숨하여 2층접근것다사니를 하여 숨겨진 합니다.wsh.Run 면실다니행됩그러▁the▁then를 실행합니다.Exec(및 proc와 상호 작용하는 다른 코드).이 접근 방식의 단점은 StdIn(그리고 어느 정도는 StdOut)을 파일에 써야 한다는 것입니다.
간단한 방법은
- 사용 가능한 c# 드라이버를 통해 Mongodb와 상호 작용할 C# dll을 만듭니다.
- Com 표시(Assemblyinfo.cs 에서), 빌드 및 등록
- excel 매크로 - > 비주얼 베이직 에디터로 이동합니다.
- 도구 ->참조를 클릭하고 등록된 어셈블리를 선택합니다.
- 그리고 VBA에 이렇게 사용합니다.
.
Private Sub CallMongo()
Dim mongoObj As New MyMongoAssembly
mongoObj.AddItem("adas");
End Sub
그게 다야..
진행 중인 ODBC 드라이버(아래에 언급됨), 이지소프트 및 cdata에서 사용할 수 있습니다.
저는 진보를 위해 노력했고 그것은 그 일을 잘 해냅니다.이러한 드라이버는 모두 라이센스가 부여된 소프트웨어이며 평가판도 사용할 수 있습니다.
가장 사용하기 쉬운 것은 cdata Excel Add-In으로, 쿼리, 업데이트 및 Excel 기반 수식 및 VBA를 사용할 수 있습니다.라이선스도 있습니다.
또 다른 방법은 mongo 클라이언트 대신 pymongo를 사용하여 pymongo를 사용하여 쿼리하고 결과를 csv 파일에 덤프하고 VBA를 통해 csv를 가져오는 것입니다.python에서 mongoDB를 쿼리하는 것은 매우 쉽습니다.
다음은 MongoDB 예제 데이터 집합에서 쿼리하는 예제입니다.
쿼리용 파이썬 파일 "queryMongoDB.py "
SERVER = "192.168.43.22" # Replace wit with Server IP or Hostname running mongod
PORT = "27017"
def queryMongoDB():
try:
from pymongo import MongoClient
client = MongoClient("mongodb://" + SERVER + ":" + PORT)
db = client.test
queryResp = db.restaurants.find({'address.zipcode': "11215", 'cuisine': 'Indian'}, {'name': 1, 'address.building': 1, 'address.street': 1, 'borough': 1, '_id': 0})
if queryResp.count() > 0 :
for row in queryResp:
printStr = ""
if 'name' in row:
printStr = row['name'] + ","
else:
printStr = ","
if 'building' in str(row):
printStr = printStr + row['address']['building'] + ","
else:
printStr = printStr + ","
if 'street' in str(row):
printStr = printStr + row['address']['street'] + ","
else:
printStr = printStr + ","
if 'borough' in row:
printStr = printStr + row['borough']
print(printStr)
else:
return -2
return 0
except ImportError:
return -1
queryMongoDB()
이 스크립트를 실행하면 다음과 같이 표준 출력으로 인쇄됩니다.
Kinara Indian Restaurant,473,5 Avenue,Brooklyn
Baluchi'S,310,5 Avenue,Brooklyn
Kanan Indian Restaurant,452,3Rd Ave,Brooklyn
New Aarpan,396,5Th Ave,Brooklyn
Indian Spice,351,7Th Ave,Brooklyn
WshShell, macro_queryMongoDB()를 사용하는 Excel VBA 매크로
Sub macro_queryMongoDB()
Dim pythonExecutable As String
Dim pythonQueryScript As String
pythonExecuatble = "python.exe" ' Path to python interpreter
pythonQueryScript = "queryMongoDB.py" 'Full path to the above Python script
If Dir(pythonExecuatble) <> "" And Dir(pythonQueryScript) <> "" Then
Dim objShell As Object
Dim objWshScriptExec As Object
Dim objStdOut As Object
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(pythonExecuatble & " " & pythonQueryScript) ' Execute the Python script
Set objStdOut = objWshScriptExec.StdOut
Set mybook = Excel.ActiveWorkbook
Set mybookSheet = mybook.ActiveSheet
Dim rline As String
Dim strline As String
Dim lineCount As Long
' Parse the results
lineCount = 1
While Not objStdOut.AtEndOfStream
rline = objStdOut.ReadLine
If rline <> "" Then
strline = rline & vbCrLf
mybookSheet.Range(mybookSheet.Cells(lineCount, "A"), mybookSheet.Cells(lineCount, "D")).Value = Split(strline, ",")
lineCount = lineCount + 1
End If
Wend
MsgBox "Query Successful"
Else
MsgBox "Python executable or Python query DB script doesn't exist."
End If
End Sub
이 매크로를 실행하면 쉼표로 구분된 데이터가 다음과 같이 행에 채워집니다.
저만의 해결책은 파이몬고와 win32com을 사용하여 파이썬이 그것들을 접착하게 하는 것이었습니다.원하는 대로 실행하는 것이 매우 간단합니다.저의 경우, 파이썬 루프는 단순히 특정 엑셀 셀을 지속적으로 "듣고" Mongo에서 필요한 것을 호출한 다음 Excel로 되돌립니다.이것은 유연하고 많은 것들을 이런 방식으로 할 수 있습니다.여기 전체 코드 베이스가 있지만, 자신의 데이터베이스와 일치하도록 호출을 Mongodb로 변경해야 합니다.여기에서는 파이썬 내에서 Excel 셀의 색상과 사물을 변경할 수 있는 특정 방법도 볼 수 있습니다.오, 나는 그것이 안시 이스케이프 시퀀스로 가득 차 있다는 것을 언급해야 합니다. 그래서 당신은 안시콘이나 콘에뮤에서 파이썬을 실행하고 싶을 것입니다.
import win32com.client as win32
import time # will need this for time parsing
from optparse import OptionParser
import pdb # debugger, when necessary
import string # for string parsing and the alphabet
from pymongo import MongoClient
import inspect
from datetime import datetime, timedelta, tzinfo
from dateutil import tz
from bson.son import SON
import msvcrt # for getch
import os
import sys # for stdout.write
from collections import OrderedDict
def parseCmdLine():
parser = OptionParser(description="Retrieve realtime data.")
parser.add_option("--f",
dest="file",
help="filename",
default="bbcapture.xls")
parser.add_option("--mongohost",
dest="mongohost",
default="192.168.1.30")
parser.add_option("--mongoport",
dest="mongoport",
type="int",
default=27017)
(options, args) = parser.parse_args()
return(options)
options = parseCmdLine() # parse the commandline
client = MongoClient(options.mongohost, options.mongoport) # link to mongo
db = client.bb # the database
bbsecs = db.bbsecs # now all the collections
bbdaily = db.bbdaily
bbticks = db.bbticks
linkstatusperiod = False # for the moving period in the top left excel cell showing we're linked
def ansi(colour = "white", bright = False, back = "black"):
# ansi colour sequences
brit = {True: "\033[1m",
False: "\033[0m"}
colo = {"black": "\033[30m",
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"magenta": "\033[35m",
"cyan": "\033[36m",
"white": "\033[37m"}
bakk = {"black": "\033[40m",
"red": "\033[41m",
"green": "\033[42m",
"yellow": "\033[43m",
"blue": "\033[44m",
"magenta": "\033[45m",
"cyan": "\033[46m",
"white": "\033[47m"}
sys.stdout.write(brit[bright])
sys.stdout.write(colo[colour])
sys.stdout.write(bakk[back])
def mdaily(ticker = "USDEUR Curncy", field = "LAST_PRICE", sortdirection = 1, numget = 1000000):
ansi("cyan", False)
print "\nGetting", ticker, "field", field, "from Mongo...",
lister = OrderedDict()
#for post in bbdaily.find({"ticker": ticker, "fieldname": field}).limit(numget).sort("time", sortdirection):
for post in bbdaily.find({"$query": {"ticker": ticker, "fieldname": field}, "$orderby": {"time": -1}}).limit(numget):
lister[str(post["time"])] = post["fieldvalue"]
ansi("cyan", True)
print "got", len(lister), "values",
ansi()
return lister
def mtick(tickers, sortdirection = 1, numget = 1000000):
if len(tickers) == 0:
return []
else:
ansi("green", False)
print "\n Getting minutes for for", tickers,
tickerdic = OrderedDict()
for eachticker in tickers:
eachdic = dict()
print numget
for post in bbticks.find({"ticker": eachticker}).limit(numget):
eachdic[post["time"]] = [post["open"], post["high"], post["low"], post["close"]]
ansi("green")
tickerdic[eachticker] = eachdic
print "got", len(eachdic), "for ticker", eachticker,
ansi("green", True)
print "got", len(tickerdic), "tickers",
dates = [set(tickerdic[x].keys()) for x in tickerdic] # get all the dates
dates = set.intersection(*dates) # get the unique ones
dates = [x for x in dates] # convert to list
if sortdirection == -1:
dates = sorted(dates, reverse = True)
else:
dates = sorted(dates, reverse = False)
retlist = [[[x, tickerdic[y][x][0], tickerdic[y][x][1], tickerdic[y][x][2], tickerdic[y][x][3]] for x in dates] for y in tickerdic.keys()]
ansi()
return retlist
def getsecs():
seclist = []
for post in bbsecs.find():
seclist.append(post["ticker"])
return(seclist)
def offsetString(startrow, startcol, endrow, endcol):
startrowstr = str(startrow)
endrowstr = str(endrow)
if(startcol > 26):
startcolstr = string.uppercase[startcol / 26 - 1] + string.uppercase[startcol % 26 - 1]
else:
startcolstr = string.uppercase[startcol - 1]
if(endcol > 26):
endcolstr = string.uppercase[endcol / 26 - 1] + string.uppercase[endcol % 26 - 1]
else:
endcolstr = string.uppercase[endcol - 1]
return(startcolstr + startrowstr + ":" + endcolstr + endrowstr)
def main():
excel = win32.gencache.EnsureDispatch("Excel.Application")
excel.Visible = 1
try: # try to link to the file
ansi("red", False)
print "Linking to", options.file
wb = excel.Workbooks(options.file)
ws = wb.Worksheets("MongoData")
ansi()
except: # not open then try to load it
try:
ansi("red", False)
print "Not open.... trying to open in current directory", os.getcwd()
ansi()
wb = excel.Workbooks.Open(os.getcwd() + "\\" + options.file)
ws = wb.Worksheets("MongoData")
ansi()
except: # can't load then ask to create it
ansi("red", True)
print options.file, "not found here. Create? (y/n) ",
ansi("yellow", True)
response = msvcrt.getch()
print response
ansi()
if response.upper() == "Y":
wb = excel.Workbooks.Add()
ws = excel.Worksheets.Add()
ws.Name = "MongoData"
wb.SaveAs(os.getcwd() + "\\" + options.file)
else: # don't wanna create it then exit
print "bye."
return
# see if ticks sheet works otherwise add it
try:
wst = wb.Worksheets("MongoTicks")
except:
wst = excel.Worksheets.Add()
wst.Name = "MongoTicks"
wst.Cells(3, 2).Value = 1
# see if securities list sheet works otherwise add it
try:
wall = wb.Worksheets("AllSecurities")
wall.Cells(1, 1).Value = "List of all securities"
wall.Range("A1:A1").Interior.ColorIndex = 8
wall.Range("A:A").ColumnWidth = 22
except:
wall = excel.Worksheets.Add()
wall.Name = "AllSecurities"
wall.Cells(1, 1).Value = "List of all securities"
wall.Range("A1:A1").Interior.ColorIndex = 8
wall.Range("A:A").ColumnWidth = 22
ansi("green", True)
print "talking to", options.file,
ansi("green", False)
print "... press any key when this console has the focus, to end communication"
ansi()
def linkstatusupdate():
global linkstatusperiod
if linkstatusperiod:
ws.Cells(1, 1).Value = "Talking to Python|"
wst.Cells(1, 1).Value = "Talking to Python!"
linkstatusperiod = False
else:
ws.Cells(1, 1).Value = "Talking to Python|"
wst.Cells(1, 1).Value = "Talking to Python!"
linkstatusperiod = True
ws.Cells(1, 2).Value = datetime.now()
# daily worksheet header formatting
ws.Cells(1, 1).Value = "Excel linked to Python"
ws.Cells(1, 3).Value = "Sort direction:"
ws.Cells(1, 4).Value = 1
ws.Cells(1, 5).Value = "Fetch max:"
ws.Cells(2, 1).Value = "Enter tickers:"
ws.Cells(3, 1).Value = "Start data:"
ws.Cells(4, 1).Value = "End data:"
ws.Range("A:A").ColumnWidth = 22
ws.Range("B:B").ColumnWidth = 20
ws.Range("A2:GS2").Interior.ColorIndex = 19 # beige 200 columns
ws.Range("A3:GS4").Interior.ColorIndex = 15 # grey
ws.Range("A2").Interior.ColorIndex = 3 # red
ws.Range("A3:A4").Interior.ColorIndex = 16 # dark grey
# minute worksheet header formatting
wst.Cells(1, 1).Value = "Excel linked to Python"
wst.Cells(2, 1).Value = "Enter tickers:"
#wst.Cells(3, 1).Value = "Enter periodicity:"
wst.Cells(1, 3).Value = "Sort direction:"
wst.Cells(1, 4).Value = 1
wst.Cells(1, 5).Value = "Fetch max:"
wst.Range("A:A").ColumnWidth = 22
wst.Range("B:B").ColumnWidth = 20
wst.Range("A2:GS3").Interior.ColorIndex = 19 # beige 200 columns
wst.Range("A4:GS5").Interior.ColorIndex = 15 # grey
wst.Range("A2:A3").Interior.ColorIndex = 4 # red
wst.Range("6:100000").Clear()
linkstatusperiod = False
oldsecd = []
oldseci = []
oldnumget = oldsortdir = toldnumget = toldsortdir = 0
while not msvcrt.kbhit():
try:
print "...", wb.Name,
securities = ws.Range("B2:GS2").Value[0]
sortdir = ws.Cells(1, 4).Value
if sortdir == None:
sortdir = 1
sortdir = int(sortdir)
numget = ws.Cells(1, 6).Value
if numget == None:
numget = 1000000
numget = int(numget)
securities = [x for x in securities if x is not None]
if not ((oldsecd == securities) and (oldnumget == numget) and (oldsortdir == sortdir)): # clear content of cells
ws.Range("5:1000000").Clear()
ws.Range("B3:GS4").Clear()
ws.Range("B3:GS4").Interior.ColorIndex = 15 # grey
oldsecd = securities
oldnumget = numget
oldsortdir = sortdir
currentcol = 0
for sec in securities:
linkstatusupdate()
secdata = mdaily(sec, "LAST_PRICE", sortdir, numget)
currentrow = 0
vallist = []
datelist = []
if sortdir == -1:
sortedkeys = sorted(secdata, reverse = True)
else:
sortedkeys = sorted(secdata, reverse = False)
for eachkey in sortedkeys:
datelist.append(eachkey)
vallist.append(secdata[eachkey])
#now stick them in Excel
ws.Range(offsetString(5 + currentrow, 2 + currentcol, 5 + currentrow + len(vallist) - 1, 2 + currentcol)).Value = \
tuple([(x, ) for x in vallist])
if currentcol == 0:
ws.Range(offsetString(5 + currentrow, 1, 5 + currentrow + len(vallist) - 1, 1)).Value = \
tuple([(x, ) for x in datelist])
if len(sortedkeys) > 0:
ws.Cells(3, 2 + currentcol).Value = sortedkeys[len(sortedkeys) - 1].split()[0] # start data date
ws.Cells(4, 2 + currentcol).Value = sortedkeys[0].split()[0] # end data date
currentcol += 1
# now do the tick data
securitiest = wst.Range("B2:GS2").Value[0]
securitiest = [x for x in securitiest if x is not None]
tsortdir = wst.Cells(1, 4).Value
if tsortdir == None:
tsortdir = 1
tsortdir = int(tsortdir)
tnumget = wst.Cells(1, 6).Value
if tnumget == None:
tnumget = 1000000
tnumget = int(tnumget)
if not ((oldseci == securitiest) and (toldnumget == tnumget) and (toldsortdir == tsortdir)): # clear the contents of the cells
wst.Range("6:1000000").Clear()
wst.Range("B4:GS5").Clear()
wst.Range("B4:GS5").Interior.ColorIndex = 15 # grey
oldseci = securitiest
toldnumget = tnumget
toldsortdir = tsortdir
secdata = mtick(securitiest, tsortdir, tnumget)
currentsec = 0
for x in secdata:
sender = [tuple(y[1:5]) for y in x]
wst.Range(offsetString(6, 2 + currentsec * 4, 6 + len(x) - 1, 5 + currentsec * 4)).Value = sender
if currentsec == 0: # then put the dates in
dates = [tuple([y[0], ]) for y in x]
wst.Range(offsetString(6, 1, 6 + len(x) - 1, 1)).Value = dates
wst.Range(offsetString(5, 2 + currentsec * 4, 5, 5 + currentsec * 4)).Value = ["open", "high", "low", "close"]
currentsec += 1
for x in range(0, len(securitiest)):
wst.Cells(4, 2 + x * 4).Value = securitiest[x]
linkstatusupdate()
allsecs = tuple([(yy, ) for yy in getsecs()])
wall.Range(offsetString(2, 1, len(allsecs) + 1, 1)).Value = allsecs
except:
print "\nExcel busy",
time.sleep(1)
endchar = msvcrt.getch() # capture the last character so it doesn't go to console
print "\nbye."
if __name__ == "__main__":
main()
ODBC 드라이버를 사용하여 Excel의 MongoDB 데이터에 연결하는 것과 관련된 다른 답변을 반향할 수 있습니다.물론 문제는 매크로를 사용할 방법이 없다는 것입니다.
Irfan이 언급했듯이 CData Excel Add-In을 사용하면 바로 그렇게 할 수 있습니다. (완전 공개, 저는 CData Software에서 일합니다.)매크로를 사용하여 MongoDB에 연결하는 방법은 도움말 문서에서 읽을 수 있지만 MongoDB 데이터를 Excel로 읽는 기본 기능을 설명하기 위해 관련 코드 조각을 여기에 포함했습니다.
Sub DoSelect()
On Error GoTo Error
p_id = InputBox("_id:", "Get _id")
If p_id = False Then
Exit Sub
End If
Dim module As New ExcelComModule
module.SetProviderName ("MongoDB")
Cursor = Application.Cursor
Application.Cursor = xlWait
Dim nameArray
nameArray = Array("_idparam")
Dim valueArray
valueArray = Array(p_id)
Query = "SELECT City, CompanyName FROM Customers WHERE _id = @_idparam"
module.SetConnectionString ("Server=127.0.0.1;Port=27017;Database=test;User=test;Password=test;")
If module.Select(Query, nameArray, valueArray) Then
Dim ColumnCount As Integer
ColumnCount = module.GetColumnCount
For Count = 0 To ColumnCount - 1
Application.ActiveSheet.Cells(1, Count + 1).Value = module.GetColumnName(Count)
Next
Dim RowIndex As Integer
RowIndex = 2
While (Not module.EOF)
For columnIndex = 0 To ColumnCount - 1
If Conversion.CInt(module.GetColumnType(columnIndex)) = Conversion.CInt(vbDate) And Not IsNull(module.GetValue(columnIndex)) Then
Application.ActiveSheet.Cells(RowIndex, columnIndex + 1).Value = Conversion.CDate(module.GetValue(columnIndex))
Else
Application.ActiveSheet.Cells(RowIndex, columnIndex + 1).Value = module.GetValue(columnIndex)
End If
Next
module.MoveNext
RowIndex = RowIndex + 1
Wend
MsgBox "The SELECT query successful."
Else
MsgBox "The SELECT query failed."
End If
Application.Cursor = Cursor
Exit Sub
Error:
MsgBox "ERROR: " & Err.Description
Application.Cursor = Cursor
End Sub
2016 버전은 현재 베타 버전이므로 오늘 무료로 Excel에서 MongoDB 데이터 작업을 시작할 수 있습니다.
주변에 타사 Mongodb COM 드라이버가 있다고 합니다: http://na-s.jp/MongoCOM/index.en.html 설치 및 참조 후 다음과 같은 쿼리를 실행할 수 있습니다.
Dim oConn
Dim oCursor,o
Set oConn = oMng.NewScopedDBConnection( cHostAndPort )
Set oCursor = oConn.Query( "ec.member", oMng.FJ("{ ""age"": 37 }")
Do While oCursor.More
Set o = oCursor.Next
MsgBox "mname: " & o("mname")
MsgBox "dept: " & o("dept")
MsgBox "age: " & o("age")
Loop
이것은 MongoDb 구조의 비정규화를 해제하고 데이터 덩어리가 필요할 때마다 즉시 SQL 쿼리 가능한 형태로 변환하는 것이 과도하다고 생각하는 사람들을 위한 것입니다;-)
MongoDB용 ODBC 드라이버를 작성하거나 찾는 것이 가장 좋은 답변이라고 생각합니다.찾으시면 알려주세요.
이를 제외하고, 적절한 쿼리를 HTML 테이블로 렌더링하는 mongodb용 웹 프런트엔드를 작성할 수 있으며, Excel의 기능을 사용하여 웹 페이지에서 HTML 테이블을 구문 분석할 수 있습니다.ODBC만큼 깨끗하지는 않지만 CSV를 반복해서 내보내는 것보다는 낫습니다.
언제든지 이 솔루션을 확인할 수 있습니다. 직접 시도해 본 적이 없으며 몇 번의 점프가 필요합니다. http://sqlmag.com/blog/integrating-mongodb-and-open-source-data-stores-power-pivot
다음은 중첩된 MongoDB 데이터 모델을 Excel 및 기타 ODBC 앱에 관계형 테이블 집합으로 노출하여 mongoDB 데이터의 충실도를 유지하는 데 도움이 되는 견고한 ODBC 드라이버입니다.
http://www.progress.com/products/datadirect-connect/odbc-drivers/data-sources/mongodb
언급URL : https://stackoverflow.com/questions/4008598/how-to-connect-mongodb-from-excel
'programing' 카테고리의 다른 글
| SQL Server 인덱스 이름 지정 규칙 (0) | 2023.05.27 |
|---|---|
| Visual Studio Code에서 서로 다른 분기를 비교하는 방법 (0) | 2023.05.27 |
| 소스= 호스트에 대한 ImageSourceConverter 오류 (0) | 2023.05.22 |
| 파일에서 임의의 줄 선택 (0) | 2023.05.22 |
| ASP.NET Core 응용 프로그램이 호스팅되는 포트를 지정하는 방법은 무엇입니까? (0) | 2023.05.22 |
