Beispiel #1
0
def CreateWorkBook(name, items, price):
    workbook = xlsxwriter.workbook("workbook")
    worksheet = workbook.add_worksheet()
    row = 1
    i = 0
    j = 0
    for item in items:

        if (item == '*' | i == 0):
            worksheet.write(row, 0, name[i])
            j = j + 1

        worksheet.write(row, 1, item)
        worksheet.write(row, 2, price[i])
        i = i + 1
        row = row + 1
    workbook.close()
            'car_price, Р': car_price,
            'car_year': car_year,
            'car_miliage, км': car_miliage
    })
    return results


for i in range(94):
    with open('test.html', 'w', encoding='utf-8') as output_file:
        url = "https://auto.ru/moskva/cars/vendor-foreign/all/do-300000/" \
              f"?page={i + 1}&sort=cr_date-desc&transmission=MECHANICAL&year_from=2005"

        r = requests.get(url)
        r.encoding = 'utf-8'
        output_file.write(r.text)
    car_s = parse_data_bs('test.html')
    car_df = pd.DataFrame(car_s)
    if i != 0:
        append_df_to_excel('/home/ivan/PycharmProjects/parse_auto_from_auto_ru/output.xlsx',
                           car_df, header=None, index=None)
    else:
        append_df_to_excel('/home/ivan/PycharmProjects/parse_auto_from_auto_ru/output.xlsx',
                           car_df, header=None, index=None)
    #car_df.to_excel('output.xlsx')
    print(car_df)

workbook = xlsxwriter.workbook('output.xlsx')
worksheet = workbook.worksheets()

for i in range(len())
worksheet.write()
Beispiel #3
0
# -*- coding:utf-8 -*-

__author__ = "Atituset"

import xlsxwriter

wb = xlsxwriter.workbook()
sheet = wb.add_worksheet()
sheet.write()
Beispiel #4
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

#https://xlsxwriter.readthedocs.org
import xlsxwriter

workbook = xlsxwriter.workbook('Results.xlsx')
worksheet = workbook.add_worksheet()

# Widen the first column to make the text clearer.
worksheet.set_column('A:A', 20)

# Add a bold format to use to highlight cells.
bold = workbook.add_format({'bold': True})

# Write some simple text.
worksheet.write('A1', 'Hello')

# Text with formatting.
worksheet.write('A2', 'World', bold)

# Write some numbers, with row/column notation.
worksheet.write(2, 0, 123)
worksheet.write(3, 0, 123.456)

# Insert an image.
worksheet.insert_image('B5', 'logo.png')

workbook.close()
Beispiel #5
0
# import xlsxwriter module
import xlsxwriter

book = xlsxwriter.workbook('Example2.xlsx')
sheet = book.add_worksheet()

# Rows and columns are zero indexed.
row = 0
column = 0

content = ["Parker", "Smith", "John"]

# iterating through the content list
for item in content:
    # write operation perform
    sheet.write(row, column, item)

    # incrementing the value of row by one with each iterations.
    row += 1

book.close()
#solveset = (x-4,x)
#print(solveset)
#x = ([[5,12,40], [30,70,2]])
#y = ([[2,1,0]])

#z = x*y
#print(z)
#plot(x**3+3, (x, -10, 10))
#f = x**2*y**3
#plot3d(f, (x,-6,6), (y, -6,6))

#======================================================

import xlsxwriter

workbook = xlsxwriter.workbook('example10.xlsx')
worksheet = workbook.add_worksheet()
worksheet.autofilter('A1:B4')
data = ["my first export example", 1, 2, 3]

format = workbook.add_format()
format.set_font_color('blake')
format.set_font_size(20)

worksheet.write_column('A1', data, format)

worksheet.write_column('B1', data, format2)

workbook.close

# =============================================================================
Beispiel #7
0
def writeExcel(ls):
    out_workbook=xlsxwriter.workbook('out_excel.xlsx')
    worksheet=out_workbook.add_worksheet('sheet1')
    for i in range(len(ls)-1):
        worksheet.write_row('A'+str(i+1),ls[i])
    out_workbook.close()
Beispiel #8
0
#!/usr/bin/python 
# -*- coding: utf-8 -*- 

#https://xlsxwriter.readthedocs.org
import xlsxwriter

workbook = xlsxwriter.workbook('Results.xlsx')
worksheet = workbook.add_worksheet()

# Widen the first column to make the text clearer.
worksheet.set_column('A:A', 20)

# Add a bold format to use to highlight cells.
bold = workbook.add_format({'bold': True})

# Write some simple text.
worksheet.write('A1', 'Hello')

# Text with formatting.
worksheet.write('A2', 'World', bold)

# Write some numbers, with row/column notation.
worksheet.write(2, 0, 123)
worksheet.write(3, 0, 123.456)

# Insert an image.
worksheet.insert_image('B5', 'logo.png')

workbook.close()
import xlsxwriter

workbook = xlsxwriter.workbook('chart.xlsx')
worksheet = workbook.add_worksheet()
# define a serie of data
SeriesData01 = []
for i in range(0,10,1)
    SeriesData01.append(random.radient(1,20))
worksheet.write_column("A1", SeriesData01)
# create a new chart object
chart = workbook.add_chart({"type" : "line"})
# add a serie of data to the chart
chart.add_series({"values" : "=Sheet1!$A$1:$A$2",
                  "line" : {"color" : ""}
                  "name" : "Type Name"})
# Save Exce File
worksheet.insert_chart("C1", chart)
workbook.close()