I have an excel sheet that I can display via pyexcel.get_book like this:
+------------------------+-------+---------------+--------------+-----------------------------------------------------------------+------------------------+----------+
| Rec No. | Title | Forenames | Surname | Address | Plaintiff Name | Amount |
+------------------------+-------+---------------+--------------+-----------------------------------------------------------------+------------------------+----------+
| 01 | MR | GUY PERSON | FITZGERALD | 69 BLAZEIT TERRACE, BAGEL ROAD, ST SAVIOUR, GERBILTONG, JE2 7TR | BANANA COMPANY LIMITED | 69420.69 |
+------------------------+-------+---------------+--------------+-----------------------------------------------------------------+------------------------+----------+
Is there a way to determine the width of the column that pyexcel calculates to display the table above (address is longer than the rest for example)? Like a col.width?
I want to convert this table to an image that takes up the full width of a page. The columns are of different widths, which I would like to use.
Related
I have multiple monthly datasets with 50 variables each. I need to append these datasets to create one single dataset. However, I also want to add the month's name to the corresponding records while appending such that I can see a new column in the final dataset which can be used to identify records belonging to a month.
Example:
Data 1: Monthly_file_201807
ID | customerCategory | Amount |
1 | home | 654.00 |
2 | corporate | 9684.65 |
Data 2: Monthly_file_201808
ID | customerCategory | Amount |
84 | SME | 985.29 |
25 | Govt | 844.88 |
On Appending, I want something like this:
ID | customerCategory | Amount | Month |
1 | home | 654.00 | 201807 |
2 | corporate | 9684.65 | 201807 |
84 | SME | 985.29 | 201808 |
25 | Govt | 844.88 | 201808 |
currently, I'm appending using following code:
List dsList = [
Data1Path,
Data2Path
].collect() {app.data.open(source:it)}
//concatenate all records into a single larger dataset
Dataset ds=app.data.create()
dsList.each(){
ds.prepareToAdd(it)
ds.addAll(it)
}
ds.save()
app.data.copy(in: ds, out: FinalAppendedDataPath)
I have used the standard append code, but unable to add that additional column with a fixed value of month in there. I don't want to loop through the data to create an additional column of "month", as my data is very large and I have multiple files.
I am trying to create a simplified logistics spreadsheet that has a static tab of items (titled 'Items available') and their available quantities that, for each item, displays the running total of that item in inventory by referencing another tab ('Released & added') of items and their continually added & subtracted quantities.
The 'Released & added' tab will be a dynamic one and will use positive integers when a part quantity is being added and negative integers when they are being reduced. A formula that counts the number of rows in the dynamic tab in order to determine the table set first would be preferable, but for my own purposes, setting lookup range to a static quantity such as 2000 would suffice.
I have tried using various formulas that utilize INDEX and MATCH, however, I cannot seem to find a solution that properly hashes the table array in the released & added tab and it looks to me as if the AGGREGATE function may be required to do so.
Sheet1:
| Part Code | Available quantity |
|-----------|--------------------|
| ABC123 | Should be 35 |
| XYZ321 | Should be 21 |
| EFG456 | Should be 25 |
Sheet2:
| Part Code | Released / Added |
|-----------|------------------|
| ABC123 | 55 |
| XYZ321 | 28 |
| ABC123 | -12 |
| EFG456 | 35 |
| EFG456 | -10 |
| XYZ321 | -7 |
| ABC123 | -8 |
Right, you seem to benefit from using SUMIF()
The formula used in B2 translates to:
=SUMIF(Sheet2!$A$2:$A$8,Sheet1!A2,Sheet2!$B$2:$B$8)
We are creating Gherkin feature files for our application to create executable specifications. Currently we have files that look like this:
Given product <type> is found
When the product is clicked
Then detailed information on the product appears
And the field text has a value
And the field price has a value
And the field buy is available
We are wondering if this whole list of and keywords that validate if fields are visible on the screen is the way to go, or if we should shorten that to something like 'validate input'.
We have a similar case in that our service can return a lot of 10's of elements for each case that we could validate. We do not validate every element for each interaction, we only test the elements that are relevant to the test case.
To make it easier to maintain and switch which elements we are using, we use scenario outlines and tables of examples.
Scenario Outline: PO Boxes correctly located
When we search in the USA for "<Input>"
Then the address contains
| Label | Text |
| PO Box | <PoBox> |
| City name | <CityName> |
| State code | <StateCode> |
| ZIP Code | <ZipCode> |
| +4 code | <ZipPlus4> |
Examples:
| ID | Input | PoBox | CityName | StateCode | ZipCode |
| 01 | PO Box 123, 12345 | PO Box 123 | Boston | MA | 12345 |
| 02 | PO Box 321, Whitefish | PO Box 123 | Whitefish | MN | 54321 |
By doing it this way, we have a generic step "the address contains" that uses the 'Label' and 'Text' to test the individual elements. It is a neat and tidy way to test a lot of potential combinations - but it probably depends on your individual use case - how important all of the fields are.
You only need to validate the ones that provide business value, which is probably all of them. I would avoid using tech terms like "field" because it isn't related to a behavior. Al Mills is right on for using the tables.
I'd word it like this:
Scenario Outline: Review product details
Given I find the product <Type>
When I select the product
Then detailed information on the product appears including
| Description | <Description> |
| Price | <Price> |
And I can buy the product
Examples:
| Type | Description | Price |
| Hose | Rubber Hose | 31.99 |
| Sprinkler | Rotating Sprinker | 12.99 |
The words I chose are behaviors or whats, not technical implementations or hows.
Hi I am using Magento and an extension called matrix rates, they use .CSV files to store the data for the post codes saying what post code has what delivery charge. The problem I have got is that it only picks the smallest delivery charge for every single postcode when it should look at the rate for the post code first and then if there isn't one pick the flat rate. I was just wondering if anybody has any ideas.
My excel sheet is like this>>
Country | Region/State | City | Zip/Postal Code From |Zip/Postal Code To | Weight From | Weight To | Shipping Price | Delivery Type
GBR | * | - | - | 0 | 9999 | 9999 | Websales Shipping (WS01)
GBR | * | - | - | AB37% | 0 | 9999 | 65 | Websales Shipping (WS01)
Without more details, your pseudo-code (or, pseudo-formula) could look like this:
=if(
vlookup([postCode], [PostCodeShipRateTable], [rateColumn]) >0,
[postcodeRate],
[flatRate]
)
[flatRate] could also be a vlookup to another rate table if nec.
What I am Trying to do is
lets say I have a excel sheet with
rows
ProductNo | Product | Sku | Price | Image | Thumb
25 | Shirt Blue | 4251 | $10 | shirt.jpg | shirtthumb.jpg
2 | Shirt Green | 4581 | $17 | green.jpg | greenthumb.jpg
8 | Shirt Black | 4561 | $15 | black.jpg | blackthumb.jpg
and just in different rows or on another excel sheet
ProductNo | Product | Sku | Price | Image | Thumb
25 | Shirt Blue | 4251 | $52 | |
2 | Shirt Green | 4581 | $42 | |
8 | Shirt Black | 4561 | $65 | |
How can i change the first table to update if the the second table or sheet columns data is different on specified columns and if the cells are empty forget about them ignore them and just replace the values from the second table onto the first
Final would be
ProductNo | Product | Sku | Price | Image | Thumb
25 | Shirt Blue | 4251 | $52 | shirt.jpg | shirtthumb.jpg
2 | Shirt Green | 4581 | $42 | green.jpg | greenthumb.jpg
8 | Shirt Black | 4561 | $65 | black.jpg | blackthumb.jpg
I have tried a couple of excel functions but they do not work since i have so many products to be doing cell additions
I tried doing in Vl but got confused and macro i dont even know what it is
Im open to whatever visual, functions just as long as i can perform the task
if anybody know hos let me know
Thank You
in stead of having the fixed values I propose you use a permanent formula in the specified columns.
Now to do this I would use a VLOOKUP() function. I am assuming that your ProductNo is the element that never changes therefore all the other columns will get a VLOOKUP() function.
Now if I understand correctly you MIGHT have an update in the 2nd table for the 1st table, but any empty cells in the 2nd table should be ignored.
I am also assuming you wish to see when an element will change because of the update therefore I propose the following:
In the first table add for the block of columns elements that might need an update: 2 blocks of columns, the first with the result of combining (the COMB-block) and the second with lookups from the 2nd table (the LOOKUP-block). For convenience of explaining I put the two tables in the same workbook on the sheets called table1 and table2
ProductNo | Product | Sku | Price | Image | Thumb | Product_comb | Sku_comb | Price_comb | Image_comb | Thumb_comb | Product_lookup | Sku_lookup | Price_lookup | Image_lookup | Thumb_lookup
Now start with formulas in the LOOKUP-block, use VLOOKUP(), such as this one for the *Product_vlookup* column:
=IFERROR(VLOOKUP($A2,table2!$A:B,COLUMNS(table2!$A:B),FALSE),"")
The IFERROR is for the case the product in table1 cannot be found in table2
For the formulas in the COMB-block the following will prefer the table 2 result over the table 1 result. As VLOOKUP of a matching ProductNo with an empty Element (for example for the Image) will result in a 0 (zero) returned all zeroes are regarded false lookup results as well. This is the script for the *Product_comb* column:
=IF(OR(ISBLANK(L2),L2=0),B2,L2)
As a final step to identify the products that changed you can either add a column that compared the original value with the _comb value:
=AND(B2=G2,C2=H2,D2=I2,E2=J2,F2=K2) (this returns true for no changed columns and false for any changed column)
Or use conditional formatting on each element separately or on the combination as the AND() formula shows.
As a final step in your process of updating you could copy all records from the COMB-block and paste it over the original elements.
If you have any further questions please ask.