Koyi yadda ake canza Excel zuwa PDF akan layi ta amfani da Python SDK. Ajiye XLS zuwa PDF.

Canza Excel zuwa PDF

Maida Excel zuwa PDF | API ɗin canza XLS zuwa PDF

A cikin wannan labarin, za mu tattauna cikakkun bayanai kan yadda ake canza Excel zuwa PDF ta amfani da Python SDK. Muna amfani da maƙunsar bayanai na Excel don adanawa, tsarawa, da waƙa da saitin bayanai. Ana amfani da shi ta hanyar asusu, masu nazarin bayanai, da sauran ƙwararru. Amma don duba waɗannan fayilolin, muna buƙatar takamaiman aikace-aikacen kamar MS Excel, OpenOffice Calc, da dai sauransu. Duk da haka, idan muka ajiye Excel zuwa PDF, ana iya duba shi akan kowane dandamali da kowace na’ura.

API ɗin Canjin Excel zuwa PDF

Aspose.Cells Cloud shine REST API yana ba da damar ƙirƙira, shiryawa da canza fayilolin Excel zuwa PDF da sauran nau’ikan da aka goyan baya. Domin amfani da waɗannan fasalulluka a cikin aikace-aikacen Python, da fatan za a gwada amfani da Aspose.Cells Cloud SDK don Python. Da fatan za a yi amfani da umarni mai zuwa a cikin na’ura wasan bidiyo don shigar da SDK:

pip install asposecellscloud

Mataki na gaba shine ƙirƙiri asusun Aspose Cloud da samun cikakkun bayanan shaidar abokin ciniki. Waɗannan takaddun shaida suna da mahimmanci don haɗawa zuwa sabis na Cloud kazalika don samun damar takardu daga ma’ajiyar girgije.

Canza Excel zuwa PDF a cikin Python

Da fatan za a bi matakan da aka bayar a ƙasa don sauya tsarin Excel zuwa tsarin PDF ta amfani da snippet code na Python.

  • Ƙirƙiri wani abu na CellsApi ta amfani da bayanan abokin ciniki
  • Ƙirƙiri abin kirtani mai ƙayyadaddun tsarin fitarwa azaman PDF
  • Kira cellsworkbookgetworkbook(…) don canza Excel zuwa PDF
# Don ƙarin samfuran lambar, da fatan za a ziyarci https://github.com/aspose-cells-cloud/aspose-cells-cloud-python
def Excel2CSV():
    try:
        client_secret = "1c9379bb7d701c26cc87e741a29987bb"
        client_id = "bbf94a2c-6d7e-4020-b4d2-b9809741374e"
        
        # fara CellsApi misali
        cellsApi = asposecellscloud.CellsApi(client_id,client_secret)

        # shigar da littafin aikin Excel
        input_file = "Book1.xlsx"
        # tsarin sakamako
        format = "PDF"
        # resultant sunan fayil
        output = "Converted.pdf"

        # kira API don fara aikin juyawa
        response = cellsApi.cells_workbook_get_workbook(name = input_file, format=format, out_path=output) 

        # buga lambar amsawa a cikin na'ura mai kwakwalwa
        print(response)

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

Hoto 1: - Preview Canja wurin Excel zuwa PDF.

Za a iya sauke samfurin fayilolin da aka yi amfani da su a cikin misalin da ke sama daga Book1.xlsx da Converted.pdf.

XLS zuwa PDF ta amfani da Umarnin CURL

Ana iya samun dama ga REST APIs ta hanyar umarnin cURL akan kowane dandamali. Tun da Aspose.Cells Cloud ya haɓaka akan gine-ginen REST, don haka za mu iya yin jujjuya XLS zuwa PDF ta amfani da umarnin cURL. Don haka da farko muna buƙatar samar da alamar samun damar JWT bisa ga shaidar abokin ciniki. Da fatan za a aiwatar da umarni mai zuwa:

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"

Yanzu muna buƙatar aiwatar da umarni mai zuwa don canza xls zuwa pdf akan layi.

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{}

Kammalawa

A cikin wannan shafin, mun tattauna matakan Canza Excel zuwa PDF ta amfani da snippets code na Python. A lokaci guda, mun bincika zaɓuɓɓukan don adana Excel zuwa PDF ta amfani da umarnin cURL. Ana iya sauke cikakken lambar tushen Python SDK daga GitHub. Muna kuma ba da shawarar ku bincika [Jagorancin Masu Shirye-shirye]]9 don ƙarin koyo game da wasu abubuwa masu ban sha’awa.

Idan kuna da wata tambaya mai alaƙa ko kun ci karo da kowace matsala yayin amfani da APIs ɗin mu, da fatan za ku iya tuntuɓar mu ta [Zauren Tallafin Fasaha na Kyauta 10.

Labarai masu alaka

Ana ba da shawarar sosai don ziyartar hanyoyin haɗin yanar gizon don ƙarin koyo game da