Можно ли добиться двунаправленной синхронизации между Excel и MongoDB? ⇐ Python
Можно ли добиться двунаправленной синхронизации между Excel и MongoDB?
A friend of mine has a team of data collectors that collect data in excel, he needs it to be updated in his MongoDb database in real time, if that's complex, he wants it to be done in a single click.
I tried writing a program that checks the file and the DB to constantly update them, I'm a beginner when it comes to programming so it looked like this
import pandas as pd from motor import MotorClient client = MotorClient('localhost', 27017) db = client['Exceldb'] collection = db['excel'] #Excel read excel_file = "Employee.csv" df = pd.read_csv(excel_file) collection.drop() # Drop existing data if any collection.insert_many(df.to_dict('records')) data = list(collection.find()) df = pd.DataFrame(data) df.to_csv(excel_file, index=False) client.close() When I ran this, nothing happened.
A friend of mine has a team of data collectors that collect data in excel, he needs it to be updated in his MongoDb database in real time, if that's complex, he wants it to be done in a single click.
I tried writing a program that checks the file and the DB to constantly update them, I'm a beginner when it comes to programming so it looked like this
import pandas as pd from motor import MotorClient client = MotorClient('localhost', 27017) db = client['Exceldb'] collection = db['excel'] #Excel read excel_file = "Employee.csv" df = pd.read_csv(excel_file) collection.drop() # Drop existing data if any collection.insert_many(df.to_dict('records')) data = list(collection.find()) df = pd.DataFrame(data) df.to_csv(excel_file, index=False) client.close() When I ran this, nothing happened.
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Невозможно добиться двунаправленной синхронизации файлов с помощью SymmetricDS
Anonymous » » в форуме Linux - 0 Ответы
- 21 Просмотры
-
Последнее сообщение Anonymous
-