Created
September 16, 2019 14:35
-
-
Save gruia-dev/aa7f6332fc9b40c8f4799e3990e8f70a to your computer and use it in GitHub Desktop.
Revisions
-
gruia-dev created this gist
Sep 16, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ import json import xlsxwriter def main(): """ for exporting licenses in json file execute pip-licenses --order=license --format=json > licenses.json Note! pip-licenses must be installed in the environment """ workbook = xlsxwriter.Workbook('licenses.xlsx') worksheet = workbook.add_worksheet() bold = workbook.add_format({'bold': True}) # Text with formatting. worksheet.write('A1', 'Name', bold) worksheet.write('B1', 'Version', bold) worksheet.write('C1', 'License', bold) with open('licenses.json') as json_file: data = json.load(json_file) print(data) print(len(data)) for idx, _license in enumerate(data): i = idx + 1 worksheet.write(i, 0, _license.get('Name')) worksheet.write(i, 1, _license.get('Version')) worksheet.write(i, 2, _license.get('License')) workbook.close() if __name__ == '__main__': main()