xlsxwriter

How to export from sql database an xlsx file with multiple sheet and exporting columns using python

我的梦境 提交于 2019-12-11 17:10:00
问题 I want to export xlsx file with multiple sheets from sql database by using queries Now I have created a three queries every query have a SELECT order for some specific data all I need now I want to export from sql database with one xlsx file but contains three sheets I new how to export data from sql database as an xlsx file but with one sheet only and this is my code from sqlalchemy import create_engine import pandas as pd import os import csv import MySQLdb from sqlalchemy import types,

Python/Excel - IOError: [Errno 2] No such file or directory:

独自空忆成欢 提交于 2019-12-11 10:51:57
问题 Attempting to extract .xlsx docs from a file and compile the data into a single worksheet. Receiving a IOError despite that the files exist Program is as follows #-------------- loop that pulls in files from folder-------------- import os #create directory from which to pull the files rootdir = r'C:\Users\username\Desktop\Mults' for subdir, dir, files in os.walk(rootdir): for file in files: print os.path.join(subdir,file) #----------------------merge work books----------------------- import

Python combination with criteria and output in excel

半腔热情 提交于 2019-12-11 08:37:41
问题 I have two lists and I want a combination which satisfies a particular condition for which I wrote the following program and printed the result in excel: a = [1.01, 5.84, 13.86, 14.72, -12.45] b = [6.42,5.67,12.51,0,7.23,8.45,9.11,18.24] combination1 = [(x,y) for x in a for y in b] c = [(1.01,18.24), (13.86,0), (5.84,0)] combined_list = [combination1 and combination1 != c] import xlsxwriter workbook = xlsxwriter.Workbook('jam.xlsx') worksheet = workbook.add_worksheet() row = 0 for group in

convert large csv file to excel using python 3

為{幸葍}努か 提交于 2019-12-11 07:29:53
问题 this is my code covert csv file to xlsx file, for small size CSV file this code is working fine, but when I tried for larger size CSV files, Its shows an error. import os import glob import csv from xlsxwriter.workbook import Workbook for csvfile in glob.glob(os.path.join('.', 'file.csv')): workbook = Workbook(csvfile[:-4] + '.xlsx') worksheet = workbook.add_worksheet() with open(csvfile, 'r', encoding='utf8') as f: reader = csv.reader(f) for r, row in enumerate(reader): for c, col in

text_wrap format gets ignored using worksheet formatting

那年仲夏 提交于 2019-12-11 06:05:38
问题 Wrap text does not work for me. I tried the below code: writer = pd.ExcelWriter(out_file_name, engine='xlsxwriter') df_input.to_excel(writer, sheet_name='Inputs') workbook = writer.book worksheet_input = writer.sheets['Inputs'] header_format = workbook.add_format({ 'bold': True, 'text_wrap': True}) # Write the column headers with the defined format. worksheet_input.set_row(1,45,header_format ) Here is the screenshot of my result Wrap text does not work for me. I tried the below code: writer =

Change angle of text on axis

為{幸葍}努か 提交于 2019-12-11 05:03:20
问题 Is it possible to change the angle of the text on an axis in XlsxWriter? In Excel, you would do this: Format Axis > Alignment > Text Layout > Custom Angle: -70 And I think a VB macro would look like this: ActiveChart.Axes(xlCategory).TickLabels.Orientation = -70 ' degrees I don't see anything in the XlsxWriter docs about this. 回答1: There is set_x_axis (set_y_axis) method for such cases i think. chart.set_x_axis({'name_font': {'bold': True, 'italic': True}}) Here is link into docs. 来源: https:/

ImportError: No module named 'xlsxwriter': Error in bamboo

萝らか妹 提交于 2019-12-11 03:53:28
问题 I have used pip to install a package named 'xlsxwriter', by using the command 'pip3 install xlsxwriter'. The code is working fine on my system, but when I am trying to run the same code on bamboo then it throwing an ImportError as "No module named 'xlsxwriter'." I have used other packages too like argparse and requests, they are working fine but for this particular package bamboo is throwing an error. When not using this particular package, the bamboo plan is successfully running, so I

TypeError 'buffer size mismatch' error when defining a series in xlsxwriter

牧云@^-^@ 提交于 2019-12-11 03:51:25
问题 I am trying to programmatically create a chart in an xlsx file using xlsxwriter and pandas data. Writing cells is succeeding fine, however when I try to define a Data Series for a Scatter chart I get a TypeError 'buffer size mismatch' and I'm fairly certain my defined range is acceptable. Example code: headers = DataFrame([[-0.398,2],[-0.201,2],[-0.001,20]],columns=['Bias','Sensitivity']) dfs = [DataFrame([[3998.28253,2.056],[3997.31816,1.978],[3996.35379,1.932],[3995.38942,1.746],[3994.42504

Rename Excel worksheet using xlsxwriter

懵懂的女人 提交于 2019-12-11 00:58:43
问题 How do i rename excel worksheet using xlsxwriter in python. I am using python 2.7 in linux to create excel reports. But cannot find an option to rename the tabs 回答1: You can set the name of a worksheet while adding it via add_worksheet(): worksheet = workbook.add_worksheet('My Custom Name') Note that you cannot set the name of an existing worksheet: There is no set_name() method. The only safe way to set the worksheet name is via the add_worksheet() method. 回答2: Another way without using any

Excel cannot open the file created by XLSXWriter

无人久伴 提交于 2019-12-10 23:59:29
问题 I am using https://github.com/mk-j/PHP_XLSXWriter library. test.php <form action="test.php" method="post"> <input type="submit" name="submit2" value="Export" /> </form> <?php if(isset($_POST['submit2']) && ($_POST['submit2'] == 'Export')) { include_once('download.php'); } ?> download.php (https://github.com/mk-j/PHP_XLSXWriter/blob/master/example.php) <?php include('./PHP_XLSXWriter-master/xlsxwriter.class.php'); ini_set('display_errors', 0); ini_set('log_errors', 1); error_reporting(E_ALL &