Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profit organisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Hello everyone, sorry for the inconvenience, is it possible to import a password-protected Excel file into Odoo?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
urgent
1 Beantwoorden
2243 Weergaven
Avatar
BEKOIN ETIENNE

Hello everyone, sorry for the inconvenience, is it possible to import a password-protected Excel file into Odoo?

0
Avatar
Annuleer
Avatar
Bhushan vagh
Beste antwoord

No it is not possible but you can use online password removal after that you can import that file
or 
Open the password-protected Excel file in Excel or another spreadsheet application. and copy to another one

3
Avatar
Annuleer
BEKOIN ETIENNE
Auteur

ah ok thanks but my problem is that I can receive more than 100 files per day and if I want to copy to another file it can slow down the work

Bhushan vagh

in that case just write script where you can encrypt password and update it
just like
def Remove_password_xlsx(filename, pw_str):
xcl = win32com.client.Dispatch("Excel.Application")
wb = xcl.Workbooks.Open(filename, False, False, None, pw_str)
xcl.DisplayAlerts = False
wb.SaveAs(filename, None, '', '')
xcl.Quit()

after that you can do your desired outcome

BEKOIN ETIENNE
Auteur

here is my code help me adapt it

from io import BytesIO

from odoo import api, fields, models, _
from odoo.exceptions import UserError
import openpyxl
import base64

#
#
# class ExcelImportWizard(models.TransientModel):
# _name = 'excel.import.wizard'
#
# excel_file = fields.Binary(string='Excel File', required=True)
# password = fields.Char(string='Password', default='IPACRCI', required=True)
#
#
# def import_excel_data(self):
# # Vérifier si un fichier Excel est téléchargé
# if not self.excel_file:
# raise UserError(_("Please upload an Excel file."))
#
# # Ouvrir le fichier Excel avec le mot de passe fourni
# excel_data = None
# try:
# excel_workbook = openpyxl.load_workbook(filename=False, data=self.excel_file, read_only=True,
# keep_links=False, pa

class ExcelImportWizard(models.TransientModel):
_name = 'excel.import.wizard'

excel_file = fields.Binary(string='Excel File', required=True)
password = fields.Char(string='Password', default='IPACRCI')

def import_excel_data(self):

if not self.excel_file:
raise UserError(_("Please upload an Excel file."))

try:

file_content = base64.b64decode(self.excel_file)
excel_workbook = openpyxl.load_workbook(filename=BytesIO(file_content), read_only=True, keep_links=False,
password=self.password)
excel_sheet = excel_workbook.active
excel_data = excel_sheet.iter_rows(values_only=True)
except Exception as e:
raise UserError(("Failed to open Excel file: %s" % e))

for row in excel_data:
self.env['excel.imported.data'].create({
'field1': row[0],
'field2': row[1],

})

raise UserError(_("Excel data imported successfully."))

class ExcelImportedData(models.Model):
_name = 'excel.imported.data'
_description = 'Excel Imported Data'

field1 = fields.Char(string='Field 1')
field2 = fields.Char(string='Field 2')

Bhushan vagh

import pandas as pd
from openpyxl import load_workbook

# Open the password-protected file
password = 'your_password'
file_path = 'path/to/password_protected_file.xlsx'
wb = load_workbook(filename=file_path, read_only=False, keep_vba=True)

add this
wb.security.workbookPassword = password
wb.save(file_path)

# Now read the unlocked file
df = pd.read_excel(file_path)

# Process the data and import it into Odoo

BEKOIN ETIENNE
Auteur

Really thank you for your help and sorry for the inconvenience, but how to do to download the file since I have a file download interface where I introduce in my old code? THANK YOU AGAIN FOR THE TIME YOU GIVE ME

Bhushan vagh

step 1:-
pip install msoffcrypto
step 2 :-
from odoo import models, fields, _
from odoo.exceptions import UserError
import base64
from io import BytesIO
import openpyxl
import msoffcrypto

class ExcelImportWizard(models.TransientModel):
_name = 'excel.import.wizard'

excel_file = fields.Binary(string='Excel File', required=True)
password = fields.Char(string='Password', default='IPACRCI')

def import_excel_data(self):
if not self.excel_file:
raise UserError(_("Please upload an Excel file."))

try:
file_content = base64.b64decode(self.excel_file)
decrypted_file = BytesIO()
office_file = msoffcrypto.OfficeFile(BytesIO(file_content))
office_file.load_key(password=self.password)
office_file.decrypt(decrypted_file)
decrypted_file.seek(0)

excel_workbook = openpyxl.load_workbook(filename=decrypted_file, read_only=True, keep_links=False)
excel_sheet = excel_workbook.active
excel_data = excel_sheet.iter_rows(values_only=True)
except Exception as e:
raise UserError(_("Failed to open Excel file: %s" % e))

for row in excel_data:
self.env['excel.imported.data'].create({
'field1': row[0],
'field2': row[1],
})

raise UserError(_("Excel data imported successfully."))

class ExcelImportedData(models.Model):
_name = 'excel.imported.data'
_description = 'Excel Imported Data'

field1 = fields.Char(string='Field 1')
field2 = fields.Char(string='Field 2')

Thanks
Feel free to connect :
Email: bhushanwagh292@gmail.com
LinkedIn: https://in.linkedin.com/in/bhushan-wagh-09a161160
Happy to help :)

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
install odoo17
urgent
Avatar
Avatar
Avatar
2
nov. 25
3050
equivalence in odoo 17 :<field name="struct_id" attrs="{'required':[('farmer','=',True)]}"/> Opgelost
urgent
Avatar
Avatar
1
jun. 24
4160
code equivalence
urgent
Avatar
Avatar
1
jun. 24
2145
install odoo17 enterprise version Opgelost
urgent
Avatar
Avatar
2
jun. 24
5620
Hello odoo community please how to install odoo 17 on a VPS running on an ubuntu 20.04 system Opgelost
urgent
Avatar
Avatar
Avatar
2
jun. 24
3341
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now