I'm working with kendo grid and I needed to export the data to excel
it keeps throw this error
ERROR TypeError: Buffer.isBuffer is not a function
I replaced my code and data with the one in this sample:
https://www.telerik.com/kendo-angular-ui/components/grid/export/excel-export/#toc-excel-export
but the excel file is not been downloading. and still getting error about buffering.
Any idea about my problem?
I think you have to import the ExcelModule
Related
This is the error message i am getting .Even on trying the code given by my tutor and online i tried fixing but ended up being not able to fix the problem
You're requesting Pandas to use the xlsxwriter engine to write your XLSX file. The error says
ModuleNotFoundError: No module named 'xlsxwriter'
To use the xlsxwriter engine, you'll need to install the xlsxwriter module.
Usually, that's done with pip install xlsxwriter.
I am connected to an Excel application and can execute the "Debug"->"Compile VBAProject" from my Python code using win32com like so (inspired by code from here):
from win32com import client
def compile(self):
self.__excel = client.GetActiveObject("Excel.Application")
compile_button = self.__excel.VBE.CommandBars.FindControl(1, 578)
compile_button.Execute()
If there is a compilation error in the Excel VBA code I get a popup message in Excel telling me the error just fine.
Now I would like to check from the Python code if there was a compilation error and raise an exception if there was. I don't necessarily need the compilation error to be part of the exception but if that were possible I would of course gladly take that, too.
Can this be done somehow?
I've been experimenting with all kinds of window counts before and after the compilation etc. but so far have not found a property of any object that would indicate that there was a popup or a compilation error.
Ok, I found a somewhat ugly but doable way - that I would like to document for others having the same issue:
You need to import a code file into the opened Excel file that has (at least) one function defined. Then you can call this function from your Python code and catch any exception. If there was an exception your code - including the imported file - did not compile, if there is none the compilation was pass.
Here's my code:
compile_code.bas
Public Sub compileCode()
' doesn't need to do anything, it just needs to be available!
End Sub
Python file
from win32com import client
def compile(self) -> bool:
self.__excel = client.GetActiveObject("Excel.Application")
self.__book = self.__excel.ActiveWorkbook
self.__book.VBProject.VBComponents.Import(<Path_to_compile_code.bas>)
try:
self.__excel.Application.Run("compileCode")
# if you reach here the code compiled
return True
except Exception:
return False
I'm trying to import a user-defined function(UDF) via xlwings but am encountering an issue. Upon pressing the import functions button in the xlwings ribbon, I receive the following run time error:
`Run_time error '1004
`Method of 'VBProject' of object '_Workbook' failed.'
According to the VBA debugger, the below module contains the problem:
Sub ImportXlwingsUdfsModule(tf As String)
' Fallback: This is called from Python as direct pywin32 calls were
' sometimes failing, see comments in the Python code
On Error Resume Next
ActiveWorkbook.VBProject.VBComponents.Remove
ActiveWorkbook.VBProject.VBComponents("xlwings_udfs")
On Error GoTo 0
**ActiveWorkbook.VBProject.VBComponents.Import tf**
End Sub
The .py file containing the UDF is saved in the same folder as the calling .xlsm workbook.
How do I rectify this so I can utilize UDFs?
Thanks to the xlwings team for providing a link that helped me resolve the issue.
One needs to ensure that Trust Access to VBA object model is enabled.
See: https://docs.xlwings.org/en/stable/udfs.html#one-time-excel-preparations
If you have trusted access to the VBA object model and you are getting a TypeError, there is an additional answer that applies to both versions 0.22.2 and 0.22.3 and maybe earlier.
In file Lib>Site-Packages>xlwings>udfs.py on line 651 or 652 (depending on the version) insert ".Item" where shown in the following:
xl_workbook.VBProject.VBComponents.Remove(xl_workbook.VBProject.VBComponents.Item("xlwings_udfs"))
I do not know why this works but it does. The original line does work in VBA with only modifications that apply to VBA syntax and the workbook reference. (i.e. see the VBA code in the question for an example.
Experimenting with Taiko for UI automation. Trying to upload a csv file but giving the id of the csv file selector is not working. A red rectangle outline blinks on top of the file upload link file firing {attach("/Users/username/Downloads/report.csv",$('*[id="some"]'))} but shows following error message in console.
Error: Node is not a file input element, run `.trace` for more info.
HTML
I've tried following fieldfield examples from https://docs.taiko.dev/#filefield
attach('report.csv', to(fileField('Upload CSV file (Optional)')))
fileField('Upload CSV file (Optional)').exists()
fileField({'id':'event-csv-upload'}).exists()
fileField({id:'event-csv-upload'},below('Upload CSV file (Optional)')).exists()
fileField(below('Upload CSV file (Optional)')).exists()
none of this works and finally tried following
attach("/Users/username/Downloads/report.csv",$('*[id="event-csv-upload"]'))
and
attach("/Users/username/Downloads/report.csv",fileField({id:'event-csv-upload'}))
source:https://github.com/getgauge/taiko/issues/309
Still not able to upload file using Taiko.
Why this file upload element is difficult to locate in angular code?
Is it too early to try Taiko now for angular web projects?
Do you recommend any other UI automation framework that work well with any angular versions?
attach expects a File input field as a selector to perform action on, in your case that element seems to be a hidden element linked to a button, attaching to that hidden element should work.
Try,
await attach("/Users/username/Downloads/report.csv",fileField({id:'eventCSVFileInput'},{ selectHiddenElements: true }))
Try this
await attach("/Users/username/Downloads/report.csv",fileField({id:'eventCSVFileInput'},{force:true}))
I am new to MS-Access.
The title is the error I get when I try to import an excel sheet into a new table in Access 2016. Note the single empty quote is part of the error message.
I've tried reinstalling, playing around with import options, importing from a CSV, CSV with different encodings, checked the table in excel for errors or inconsistencies.
I have searched and searched without luck. Help would be appreciated.
ADDENDUM:
The CSV I've tried to import is:
CashAccountID,AccountDescription,BankName,BankAccountNumber
301,Primary Checking Account,MegaBank,9017765453
302,Money Market Account,Wells Gargle,3831157490
303,Payroll Account,MegaBank,9835320050
I've encountered the same error and, from trial and error, it appears the issue is related to the size of the Excel file you're importing from. I've had success by splitting the 70MB Excel file into two 35MB files before doing the same import into Excel.
The error message from MS Access is nonsensical - the problem occurs when we're not using an import/export specification at all (and nor are there any saved in the Access I'm running). I think we can put this failure and erroneous error message down as an MS Access bug.