Sinau carane ngowahi Excel dadi PDF online nggunakake Python SDK. Simpen XLS menyang PDF.

Ngonversi Excel dadi PDF

Ngonversi Excel menyang PDF | API konversi XLS menyang PDF

Ing artikel iki, kita bakal ngrembug rincian babagan carane ngowahi Excel dadi PDF nggunakake Python SDK. Kita nggunakake spreadsheet Excel kanggo nyimpen, ngatur, lan nglacak set data. Iki digunakake dening akuntan, analis data, lan profesional liyane. Nanging kanggo ndeleng file kasebut, kita butuh aplikasi khusus kayata MS Excel, OpenOffice Calc, lsp. Nanging, yen kita nyimpen Excel menyang PDF, bisa dideleng ing platform lan piranti apa wae.

API Konversi Excel menyang PDF

Aspose.Cells Cloud minangka REST API sing nawakake kemampuan kanggo nggawe, ngowahi lan ngowahi file excel dadi PDF lan format liyane sing didhukung. Kanggo nggunakake fitur kasebut ing aplikasi Python, coba gunakake Aspose.Cells Cloud SDK for Python. Gunakake printah ing ngisor iki ing console kanggo nginstal SDK:

pip install asposecellscloud

Langkah sabanjure yaiku nggawe akun Aspose Cloud lan entuk rincian kredensial klien. Kredensial iki perlu kanggo nyambung menyang layanan Cloud uga kanggo ngakses dokumen saka panyimpenan maya.

Ngonversi Excel menyang PDF ing Python

Tindakake langkah-langkah ing ngisor iki kanggo ngowahi format Excel dadi PDF nggunakake potongan kode Python.

# Kanggo conto kode liyane, bukak https://github.com/aspose-cells-cloud/aspose-cells-cloud-python
def Excel2CSV():
    try:
        client_secret = "1c9379bb7d701c26cc87e741a29987bb"
        client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e"
        
        # initialize CellsApi instnace
        cellsApi = asposecellscloud.CellsApi(client_id,client_secret)

        # input buku kerja Excel
        input_file = "Book1.xlsx"
        # format asil
        format = "PDF"
        # jeneng berkas asil
        output = "Converted.pdf"

        # nelpon API kanggo miwiti operasi konversi
        response = cellsApi.cells_workbook_get_workbook(name = input_file, format=format, out_path=output) 

        # print kode respon ing console
        print(response)

    except ApiException as e:
        print("Exception while calling CellsApi: {0}".format(e))
        print("Code:" + str(e.code))
        print("Message:" + e.message)
Excel kanggo PDF

Gambar 1: - Pratinjau konversi Excel menyang PDF.

File sampel sing digunakake ing conto ing ndhuwur bisa diundhuh saka Book1.xlsx lan Converted.pdf.

XLS menyang PDF nggunakake CURL Commands

API REST bisa gampang diakses liwat perintah cURL ing platform apa wae. Wiwit Aspose.Cells Cloud dikembangake ing arsitektur REST, supaya kita uga bisa nindakake XLS kanggo konversi PDF nggunakake printah cURL. Dadi pisanan kita kudu ngasilake token akses JWT adhedhasar kredensial klien. Mangga nglakokake printah ing ngisor iki:

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Saiki kita kudu nglakokake perintah ing ngisor iki kanggo ngowahi xls dadi pdf online.

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/Book1.xlsx?format=PDF&isAutoFit=true&onlySaveTable=false&outPath=Converted.pdf&checkExcelRestriction=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-d{}

Kesimpulan

Ing blog iki, kita wis ngrembug langkah-langkah Ngonversi Excel dadi PDF nggunakake potongan kode Python. Ing wektu sing padha, kita wis njelajah pilihan kanggo nyimpen Excel menyang PDF nggunakake perintah cURL. Kode sumber lengkap Python SDK bisa diundhuh saka GitHub. Disaranake sampeyan uga njelajah Pandhuan Programmer kanggo sinau luwih lengkap babagan fitur-fitur liyane sing nyenengake.

Yen sampeyan duwe pitakon sing gegandhengan utawa nemoni masalah nalika nggunakake API, hubungi kita liwat Forum Dhukungan Teknis Gratis.

Artikel sing gegandhengan

Apike banget kanggo ngunjungi link ing ngisor iki kanggo mangerteni sing luwih lengkap