简体   繁体   中英

Is it possible to run openpyxl on an Android Kivy application?

I am creating an application using Python Kivy that would take the user's input and create an Excel file storing the input.

I tried using openpyxl but the app crashes before starting on my android phone but on a desktop computer, it works perfectly. Is it possible to modify Excel files on my Android phone using Kivy and Openpyxl?

import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
import openpyxl

class MyApp(App):
    def build(self):
        return MyGrid()

class MyGrid(GridLayout):
    def __init__(self,**kwargs):
        self.submit = Button(text='Submit', font_size=30)
        self.submit.bind(on_press=self.pressed2)
        self.add_widget(self.submit)
    def pressed2(self,instance):
        wb = openpyxl.Workbook()
        ws = wb.active
        ws['A1']='Hello'
        wb.save('Trial.xlsx')

if __name__ == "__main__":
    MyApp().run()

I use Kivy Launcher and the app crashes but if I remove all openpyxl stuff and put any other function, it works perfectly. I'm expecting it to create an Excel file on my phone. If this is not possible, what can I do instead?

It looks like it's probably a pure python library so it's likely to work without issues on Android, but you'll need to build an APK that actually includes it. It might also turn out that it does have dependencies that are hard to build for some reason, but you'll have to try it to see.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM