只需打开excel应用程序打开现有excel文件即可

时间:2018-03-24 19:11:12

标签: python excel

excel已经打开,在某些代码的末尾我只是尝试使用以下代码打开2个excel文件。但是,没有任何东西加载!

from urllib.request import urlopen
from bs4 import BeautifulSoup
import csv
import datetime
import openpyxl
import time

openPythonQuoteLS = openpyxl.load_workbook('c:\ls_equity\quote\PythonQuoteLS.xlsx')

openQuoteLS = openpyxl.load_workbook('c:\ls_equity\quote\QuoteLS.xlsm')

1 个答案:

答案 0 :(得分:0)

如果您只想在Excel中打开文件,您可以使用操作系统库将命令发送到操作系统以打开文件,如上面提到的Aran-Fey。

对于您的特定文件:

private String saveToInternalStorage(Bitmap bitmapImage, String id){
        String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        timestamp+=("_"+id);
        ContextWrapper cw = new ContextWrapper(getApplicationContext());
        // path to /data/data/yourapp/app_data/imageDir

        File mypath=new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/CarPlate", timestamp+".png");   // file name

        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(mypath);
            // Use the compress method on the BitMap object to write image to the OutputStream
            bitmapImage.compress(Bitmap.CompressFormat.JPEG, 80, fos);
            Log.d(TAG, "onCameraFrame. image stored at : " + Environment.getExternalStorageDirectory().getAbsolutePath()+"/CarPlate");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return Environment.getExternalStorageDirectory().getAbsolutePath();
    }