Update a cell in Excel with power automate - excel

I have a process to automate, and I find it a bit difficult to do it. The purpose of the process is to retrieve a table from an excel file (this file contains several sheets, each sheet contains several tables), and update a cell of this table. The problem is that this flow must be launched each month, to recover the excel file created in a SharePoint site and update the desired cell.
Here is what I did :
I declared my variables of date, then i listed the table from the excel file ...
After that i tried to update the cell with the "Update a row" action ...
... the flow manages to retrieve the list of data in the table, but it cannot find the cell to update
Here is the error message:
Has anyone done this before or have an idea how to do this?
Thanks in advance for your feedback.

Related

power automate flow excel table keys or columns

How do you get a list of the Table columns/keys from a Table in an EXCEL file, in a One Drive folder. I am probably using incorrect terms - apologies. I am already successfully using "List rows present in Table" - when column names are already known. But ... in my current task, the Table columns/keys are unknown and need to be listed.
Thanks for your patience.
Kevin.

Comparing data between two sheets in Powershell - how to find data after cells with specific values?

To start, unfortunately I cannot use Import-Excel (yet! organization is looking to implement the module "soon") or other outside modules, so am just working with excel objects manually.
I made an automated report that appends to an excel document every day. It looks something like the included picture. The servers and their data are not in the same cell position for each daily sheet, but are always grouped together (so Server1 and its data might be in the middle of today's sheet, but at the beginning yesterdays sheet). Databases can change, so I'll also be looking into error checking that a database actually exists on both sheets to compare them.
I want to check the most recent sheet (sheet labeled 2020-08-10) and compare each database with the same databases on the oldest sheet (sheet labeled 2020-08-08) to get a size % difference between each database, but I can't seem to figure out how to automate finding the multiple "Database" rows of each server, then going down and grabbing each database and size to compare.
Any help or guidance to get me researching in the right direction is appreciated.

Updating a table from a power query changes formula reference

Saw this was previously asked here on SO and had no solution and I can't find a solution through Google either.
I have a workbook with a tab called "Data" containing a table which is updated via a power query and another tab called "Calcs" with formulas referencing the cells in the table from "Data". When I refresh the table, it pulls data via the power query, but when it's done, the formula references change.
For example, before the refresh, I'll have formulas like this in the "Calcs" tab:
=COUNTIFS('Data'!$A$2:$A$26886,$A1060,'Data'!$K$2:$K$26886,'BY CAT'!$B1060)
After the refresh, the references for column A only change to
=COUNTIFS('Data'!$A$10242:$A$26886,$A1060,'Data'!$K$2:$K$26886,'BY CAT'!$B1060)
And it results ina #VALUE! error message.
How can I prevent Excel from creating this reference shift?
You might be able to get around this by using full column references:
=COUNTIFS('Data'!$A:$A,$A1060,'Data'!$K:$K,'BY CAT'!$B1060)
Full column references aren't always a good idea, but it might just work in this case.
Edit:
Table column references would be ideal, TableName[ColumnName]. These should work given that you are reading from a power query generated table.

Copy and paste Excel rows between two workbooks based on criteria from exported Access data

I have no previous experience in Access, VBA coding or in Excel macros prior to teaching myself the past month via these forums. Thank you forums and contributors. I have enjoyed my Access learnings so far, the challenge that it has provided and appreciate any help that I can get. As such, the code and methods that I have used to this point may well be convoluted and confusing. I will do my best to provide relevant details and accurate terminology.
I work in a lab and I am creating an Access Form for semi-automated reporting. Samples are received from clients and are logged into the Excel Table R&D Log. The worksheet is InProcess. Samples are sorted based on the site in which they originate and given a one or two letter site code (G, D, WH, etc.) and an ID "yy-000" in separate Excel columns (i.e. D 18-096). Samples may be submitted for multiple analyses (Metals, Water, Soil, etc.) and may even have multiple rows of reporting if multiple analytes are identified in the sample. There are several other columns, such as receipt date, reporting date, units, etc. Once samples are reported, I manually copy and paste them into the Archived worksheet, and delete the record and blank row from the InProcess worksheet. Since one sample may have multiple analyses and even more potential results, each record would be reported on a new Excel row (with the same D 18-096 ID number). Thus, there is not a single unique identifier or primary key for each sample in the current format. R&D Log is updated manually by lab technicians and the worksheet InProcess is a linked table in an Access Database.
The Access Database is using two combo boxes on a Form frmInProcess to filter a Query qryInProcess of the linked table. The combo boxes are filtering the report destination (one client may receive multiple site codes) and the analysis (reports are separated based on type of analysis). The Query is also filtering out blank results and blank dates, so only completed samples will appear on the filtered Form. I have generated VBA code to this point that will export the Form to a .pdf, save the file with unique filename, and open outlook to mail out the report. I have also managed to export the filtered Form frmInProcess to an Excel file Access Test (not the linked file).
What I would like to do now is to automate the transfer of completed test results from the Excel worksheet R&D Log: InProcess to R&D Log: Archived and delete the record from the InProcess worksheet. I am not sure if I can export the filtered Form into a linked Excel table, or if I must use a separate Excel file (or if it even matters for simplicity of code?). I would now like to read the exported filtered Form in Excel Access Test, lookup matching rows in R&D Log based on several criteria (site, ID, Analysis, Analyte, Report Date) and automate the transfer of records between R&D Log worksheets. End result being that Access generates reports for completed tests, and the records are removed from InProcess testing and transferred to Archived testing in Excel. I am guessing that I may need to close the Access application and perform this in Excel. Hope this is easy enough to follow.
Thank you.
In my experience, importing an Excel document into a temporary NEW (or totally empty) Access table is usually the easiest way to go. Then you do not have to worry about cell references like you do in Excel VBA. Even if the Excel document has old data in it with just a few new changes each time, importing it into a temporary Access table could be the simplest way to go, because then you can compare the data in this table with the data in another, permanent Access table and update the latter based on the former.
As far as the original Excel file, if you need to delete rows there, it might be quicker to export a new Excel file with just the data the old one is supposed to end up with, and then use VBA to delete (or - safer! - rename) the old file.
So the development process goes something like this:
Save import steps by first importing an Excel file via Access' ribbon options "External Data" (tab) ->"Excel" and when you finish, be sure to check the "Save import steps" box and note the name you give the "saved import" because you will need that in your VBA code.
In Access, write a function for deleting the table. The VBA code is:
Const cTable = "MyExcelTempTable"
If TableExists(cTable) Then
DoCmd.DeleteObject acTable, cTable
End If
Now you can test your delete function on the data you imported.
Write VBA code to import the same spreadsheet to create the same table:
Const cSavedImport = "Import-MyExcelTempTable"
' Import the Excel file
DoCmd.RunSavedImportExport cSavedImport
Write more VBA function(s) to check the imported table for bad data and then to copy it into the permanent table. You might be updating existing records or adding new ones. Either way, you could use Access queries or SQL to do this and run them from VBA.
Write a VBA function to rename the old Excel file. (You could use an InputBox if the Excel file name is different each time. I do this for importing Excel files, and I set a default value so I do not have to type as much.)
Write a VBA function to export the new version of the Excel file.
Make yourself a button on a form that, when clicked, runs a VBA function. Inside that function, run Steps 2 through 6, above.
I am not sure my answer exactly matches what you are trying to do, but hopefully you get enough of a picture of the workflow to figure out the details of what you need.

Excel format lost while populating thru SSIS

I have an formatted excel destination with one of the columns being a percentage and another being currency. I'm loading this excel with data from a sql table using SSIS. However the excel is not formatted after the load. What is happening?
I was able export two columns of information (percent and dollar value) to an Excel file (97-2003 format) from an SSIS package created in Visual Studio 2010. The data was sourced from a table on a server using SQL Server 2012.
Steps:
Created an Excel file containing a column called Percent and another called Cost. Both were formatted accordingly and are located in the first row.
Saved the file in a 97-2003 format and then closed it.
Created a table in a database and populated it with a couple of records.
create table test_export (
mypercent numeric(18,2),
mydollar numeric(18,2))
insert into test_export values (2.1, 50.00)
insert into test_export values (4.5, 120.00)
Opened Visual Studio 2010 and created a new SSIS package. Created an OLEDB connection to the database.
Under the Control Flow tab added a Data Flow Task and double-clicked on it after it was added. This should now highlight the Data Flow tab.
Add an OLE DB Source and point to the newly added database connection, under Data access mode select Table or View and then select the table created in step #3. Select the OK button.
Add an Excel Destination making certain to create a new Excel connection manager for it and point to the Sheet1$. Make certain to indicate that the first row contains headers. Select the OK button and connect the OLE DB Source task to the Excel Destination task below. Since only numbers are involved, there is no need to apply a Data Conversion task between the two. But in the Excel Destination task remember to select Mappings and connect from left to right which source columns match up with which destination columns.
In the Solution Explorer pane, right-click on the solution and select Properties from the drop-down menu. Open Configuration Properties on the left and the select Debugging under it. On the right under Debug Options, look for Run64BitRuntime and change it from True to False if you have not already done so. Select the OK button.
Run the SSIS package.
Stop the SSIS package when all of the tasks show green for completed.
Open the Excel file and it will now contain the values imported from the database table with the Excel percent and dollar formats preserved from step #1.
I ran these steps in a test and everything worked perfectly. If your formats are not being preserved, then you are likely leaving out a step.
Hope this helps and please indicate if it answered your question.
I had the same problem. What I did was:
apply conditional formatting on the column.
see attached picture
It is also important that you have in the first row, a model row, filled with numeric/text values, in order for the ssis to export the numbers as numbers and not as strings model row
If your template contains several rows before the place where ssis start to export the data, you might need to have more model rows. (I needed 4). This rows have to be the first rows in the document, regardless where you start the export.
You can hide the model rows

Resources