Commencer
Contents
[
Hide
]
Configuration requise
Aspose.Cells for Python via .NET est indépendant de la plate-forme API et peut être utilisé sur n’importe quelle plate-forme (Windows et Linux) oùPython est installé.
Version Python
- Python 3.6 ou supérieur
Installation
Windows:
Vous pouvez facilement utiliser Aspose.Cells for Python via .NET à partir depypi avec la commande suivante.
$ pip install aspose-cells-python
Linux :
Vous pouvez facilement utiliser Aspose.Cells for Python via .NET à partir depypi avec la commande suivante.
$ pip install aspose-cells-python
Mac OS :
Vous pouvez facilement utiliser Aspose.Cells for Python via .NET à partir depypi avec la commande suivante.
$ pip install aspose-cells-python
- Remarque : Si votre python est Python3.7 (prenez python3.7, par exemple, ici), après avoir installé aspose-cells-python, il peut y avoir les erreurs suivantes
‘/usr/local/lib/libpython3.7m.dylib’ (aucun fichier de ce type), ‘/usr/lib/libpython3.7m.dylib’ (aucun fichier de ce type).
Dans une telle situation, veuillez ajouter la commande suivante à votre bash_profile (Recherchez d’abord où se trouve libpython3.7m.dylib, prenez /Library/Frameworks/Python.framework/Versions/3.7/lib
par exemple ici)
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/Library/Frameworks/Python.framework/Versions/3.7/lib" export LIBRARY_PATH="$LIBRARY_PATH:/Library/Frameworks/Python.framework/Versions/3.7/lib/"
Création de l’application Hello World
- Créer un fichier nomméCréationHelloWorldFile.py et utilisez l’exemple de code suivant :
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.cells | |
from aspose.cells import Workbook | |
# Create an instance of the Workbook class. | |
workbook = Workbook() | |
# Insert the words Hello World! into a cell accessed. | |
workbook.worksheets.get(0).cells.get("A1").put_value("Hello World") | |
# Save as XLS file | |
workbook.save("output.xls") | |
# Save as XLSX file | |
workbook.save("output.xlsx") | |
# Save as ods file | |
workbook.save("output.ods") |
- Maintenant, enregistrez le code ci-dessus dans “CreatingHelloWorldFile.py” et exécutez “python CreatingHelloWorldFile.py” @invite de commande.