How to read arabic text contents from an excel sheet in BluePrism? - excel

I am new to BluePrism and trying to read Arabic from an Excel sheet. But when I open collection process it shows question marks instead of showing Arabic characters. I tried to write this data into another sheet but it prints the same question mark rather Arabic.

I tried to use the Get Cell Value command and that worked well with Arabic, which lead me to believe the problem isn't with Blue Prism as a whole, but only in the way the Get Range Collection is built.
If you have a look at the VB.NET code behind the action, you see that the BP developers first copy the range into clipboard and then parse the clipboard contents into the collection. That's where the problem most likely occurs.
A quick workaround would be not using the Get Range as Collection at all and use just the Get Cell Value instead, longer workaround would be modifying the Get Range as Collection action.
I can see two options for the longer workaround as well. Either you figure out the problem with the way the clipboard parsing works and fix it, or you change the logic to fill the DataTable directly (for each row and for each column set cell value to Table). The performance will be worse, but it will work).

Probably you need to install the Font on your machine and get the Worksheet as a collection. Or maybe Translate all in English, get it and then translate it in Arabic Again, Or maybe read cell by cell if entire collection isn't working.
It would be helpful to have the worksheet as example.

Related

If I have already set print areas desired, how do I print only the pages which include non-"" formula results?

As an inventory control specialist, I set up a macro and some formulas to paste and mine data copied from a IBM Power 9 inventory bin location database.
The end goal was to create a hard copy array of all bin locations with their bar codes and room for audit notes. The results worksheet is already set up with the desired formulas and formatting and divided into the desired print areas so that running the macro simply populates it with the names and barcodes of up to 2000 bin locations.
Everything works like a charm, but currently I need to use print preview and manually set the range of active sheets to print, as not all of the 48 pages spanning the active cells containing formatting and formulas are used for any given group of bins.
I have searched multiple sites for hours and have not found any code that is remotely helpful, and my self-taught VBA skill is limited to simple macros and slight modifications of other peoples' code. Is there a way to program a macro to print only pages (as defined by predetermined print areas) with values (non-""-result formulas) while ignoring pages filled only with ""-result formulas and formatting? I am running Excel for Office 365.
Thanks
My response was too long for the comment field and, more or less, answers your question so I moved it here.
The way I imagine your data, I'd loop through every page in the workbook. While on a page, I'd loop through every formula until I found a result that is not blank. On finding a non-blank result, I'd add the page to a list of pages to print and move to the next page. After checking the last page, I'd print each page on the list.
You may want to define the steps required to complete your project (similar to what I just did) because each step requires several motions and almost every one of them will be a new challenge for someone with your experience. Once defined, find the most fundamental movements that are critical to your program and start there. Keep it simple, you will not always know what the challenge will be or where it will come from. What looked like a simple step, like looping between pages, requires a basic understanding of the workbook object and that is a far more complex subject than a loop.
Keep in mind that we are here to solve problems with your current code. If you don't have a problem with existing code then there is not much that can be done beyond pointing you toward a path.
After reviewing the links provided by #ProfoundlyOblivious I quickly determined I lacked the skill to program a solution using VBA as suggested. However, trying to parse all that information got my brain on a roll and I did develop a very simple and sneaky workaround using formulas tied in with a simple one line macro.
Assuming all pages predefined by print areas are the same width, and assuming there is at least one cell that will always consistently be populated in on a used page, these instructions should work for you should you have a similar issue.
Enter the following simple binary IF formula in a blank row of the first page:
=IF(A1<>"",1,0)
where A1 is a cell in the first page containing a formula that would be guaranteed to consistently return a value if that page is being used. (in my case, the imported information is imported in columns beginning with the upper left corner of each page).
Select the row of the page (not the entire row of the worksheet, just the width of the page as defined by the print area) containing the formula, and drag fill across to all possible pages, then in the same row of the last page simply add a SUM(,,,,) formula referencing (adding) all of the binary IF(X,1,0) formulas. The resulting sum will be the number of populated pages.
Clunky, but functional.
Finally, the simple print macro:
Sub Print_Audit_Sheets()
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=Range("JW42").Value, Copies:=1, Collate:=True, IgnorePrintAreas:=False
End Sub
Where ("JW42") is the reference to the range with the SUM() of all the binary IF() formulas. It isn't fancy, but it's simple, and simple works. Be sure to change the text color on the IF() binary and Sum() cells so that you don't have random 1s and 0s obtruding in your printouts.
You will need to modify this code if your first page is not consistently populated or your value-containing pages are not contiguous.

Downloading File with importrange function failing - think it's a bug

I've been saving Google Sheets to Excel without any problems for a while. These sheets have always successfully saved and opened in Excel with the importrange function. However, recently it hasn't been successfully saving correctly.
It used to just have the static value (e.g, 40). There used to be an IFERROR in the first cell in the header row but now it exists in every single cell.
E.g, each cell would have something like this:
=IFERROR(__xludf.DUMMYFUNCTION(importrange(blahblah)),"40").
DUMMYFUNCTION throws an error and "40" is returned as a result. but "40" is a string, not an integer which messes up all my formulas.
I also know this isn't an Excel issue because OpenOffice is doing the same thing with the file.
I'm pretty sure this would be a bug because why would it be working for months and then suddenly stop working?
What should I do?
I'm thinking it's a bug too.
Workarounds
On Excel
Copy and paste as values only the ranges with IFERROR(__xludf.DUMMYFUNCTION(..., then use Excel's UI tools to convert numbers shown as text to numbers.
Selectively remove quotes on the IFERROR second argument of the cells causing problems
Remove =IFERROR(__xludf.DUMMYFUNCTION(),"value") except value (we could use Excel's built-in FIND & REPLACE for this)
On Google Sheets
Use Copy > Paste as values only on the range areas having formulas with non-compatible functions like IMPORTRANGE, QUERY, FILTER, etc.
If you only need the values, download it as CSV instead of XLSX
IMPORTANT
In order to help to prioritize this issue, send feedback to Google. To do this open a Google Sheets spreadsheet, click on Help > Report a problem, then fill the feedback form and submit it.
Related stuff
I posted 5 small articles about this in Spanish. You could find them listed on https://www.rubenrivera.mx/p/descargar-hcg-excel.html.
We accidentally created a workaround for this bug with a different sheet that was just set up like this.
This works when you IMPORTRANGE into another Google Sheet. We are doing it into a Google Sheet with a single worksheet - haven't tried it with multiple.
It's going to sound a little nuts but it works for us.
In the first cell of your import range put a hyperlink in the original document you are importing from. This is in the first cell of the import range. We linked it to a worksheet in the original document. It has worked and failed with an external link. With an external link it worked when I linked it to an internal link, then changed it. But when I deleted the cell and just straight linked it to an external URL it didn't work.
Then #timbo was right - put data validation in. This can be in part of the document that isn't being imported into the second sheet. I put it in the first line of the import range but outside what I was importing. It might have to be the first line. I just put a date in one cell, then in the next cell data > data validation > then choose that one date as the data range.
For aesthetics I have hidden the first row in one Google Sheet I am importing into. In another I made the first cell link the title of the sheet and put the data validation outside the import range. Both of these work.
Let me know if this works for you.
Until this bug is fixed, a workaround is to put a data validation (Data > Data Validation) on the imported data (Any kind of data validation will do).

Cell reference with hyperlinked text

I am attempting to do something which sounds very simple, yet I couldn't find an answer anywhere online or here.
I am building an Excel database and have the main sheet with all the data I need, in which everything works great. I have many cells with text, and that text contains a hyperlink (in which I mean the URL is different than the text in the cell).
I have many other sheets which reference the main one. I have attempted to simply link the cells to their counterparts in the main (using a simple =location formula), but that only copies the text.
I then tried using =HYPERLINK(location), but that copies the text and creates a hyperlink, using the text as a URL instead of importing the URL I originally used.
What I want to do is link to another cell, displaying the text, but giving it the original URL I used in the main sheet.
EDIT: I want to be clear, that I can't use =HYPERLINK(location, name) because that still references the text in the original cell, NOT its hyperlink.
It could work if there would be a way to link a cell to the hyperlink in another cell, not the text in that cell.
Is such a thing possible at all without starting to use MACRO commands?
Not that it's a deal breaker, but I'd rather not get into it if I don't have to (since other people will work on it in the future, and they might not know anything about it).
A short User Defined Function (aka UDF) can strip the .Address property from the Hyperlink object.
Function what_url(rHL As Range)
If CBool(rHL.Cells(1).Hyperlinks.Count) Then
what_url = rHL.Hyperlinks(1).Address
Else
what_url = "not a hylerlink"
End If
End Function
There is also a .SubAddress property that can be appended to the .Address if required.

Groovy POI created cells considered blank by other programs until ENTER is manually pressed in cells

Ok this is kind of hard to explain.
I create a cell in my worksheet using JAVA POI
newCell= row.getCell(index)
if (containerCell == null) {
containerCell = row.createCell(index)
}
newCell.setCellType(HSSFCell.CELL_TYPE_STRING)
newCell.setCellValue(strVar)
If i then open the worksheet in EXCEL, I see that the cell value is indeed set. However if I load this into another external program that reads EXCEL sheets, it claims the cell I just set is blank.
NOW, if I go back into excel and do a simple "Hit return" on the cell in question, in the formula bar (even though its not a formula) and try to reload it into the external program, it works fine. Do I need to evaluate a formula on a string?
Thanks
I have no experience with Java, but having to hit enter in a cell is usually indicative of calculation being set to manual. Since you are working with API it may be treating your input from Java as a formula (?).
Open the offending workbook in its broken state, and on the sheet you are having problems with choose [Formulas] tab at top, then [Calculation]>Calculate Sheet.
If this updates the value then I see two options...
See if there is an option to manually calculate the sheet with POI, after the value has been entered.
Alternatively, you can write just a tiny bit of VBA to force calculation on that sheet when workbook is opened. MSDN offers a simple example.
http://msdn.microsoft.com/en-us/library/office/aa223802%28v=office.11%29.aspx
I have had to do this for Excel apps where calculation had to be set to manual to avoid excessive overhead. Just a guess though..
I am not sure why this was happening.. and evaluating the individual cells did not solve it however running evaluteAll() on the entire workbook made it work!

VBA - Pretty Print a Row in Excel

I want to print a row in Excel.
One row contains data for one project.
I want to print one row on one page nicely formatted. Meaning the value of one cell is the header and should be printed fat and centred, the other values should also be placed at fixed positions on the page.
Is this with VBA possible? When I was searching for this problem I only found results for printing a worksheet or a table or parts of it, but no results to use the values of the cells and formatting them.
Thanks in advance
As the other answers indicate, it is certainly possible in Excel VBA, but it is not really Excel's strong point.
What would typically be done to obtain the result you seem to be after is use a fully formatted Word document with fields that are then filled in with values from an Excel worksheet. You can even cheat a bit and use the Mail Merge \ Letter wizard to set everything up.
If you do want to do it all in Excel, you can find instructions and an example VBA macro here:
http://www.tek-tips.com/faqs.cfm?fid=4223
Template is a good way to do. With a macro there's better performance where it avoids the usage of volatile functions such as INDIRECT() However again it depends on how many volatile functions your worksheet carries.
Yes, it is possible when you use the Styles in excel. I know you can do Font formatting quite easily. Not sure about indenting it, but worth a try.
If style doesnt support it (it might in Excel 2010), you can always indent it via VBA (record a macro when you indent the values , it should look like this):
Selection.InsertIndent 1

Resources