How to copy an excel sheet to a text container - excel

I do use selenium to automate the website I work. Here I have a rare scenario where a text container that represents data like a spreadsheet. So user is given with an option to copy data from spreadsheet and paste it the text container.
I would like to copy data from a sheet and paste same in the test container as a whole. So the test container displays the data in a table, as it looks in excel.
Can anyone please help me with your suggestions......
Thanks

You don't need to automate a real Excel instance (you can't anyway), or the copy/pasting process. Just write the code to directly set a fixed amount of data (e.g. read from a file) into your container, and from then you can verify that it all appears / was saved etc.
How you get the test data into your test case, so that it can get inserted into the container, depends upon the way the container works.
If it's efficient enough, you can just use POI to load the contents of an Excel file (packaged in your project alongside your test), manipulate it into whatever format the container needs, and then set it.
If it's more efficient, just extract the test data once and store it in a text file for setting into the container, if that allows you to drop POI.

Related

Move data stored in excel file and queries to external source (local) to be available to other excel files

I recently modernized all my excel files, and started using the magic of PowerQueries and PowerPivot.
Background: I have 2 files:
- First one is a "master" with all sales and production logs, and everything works inside that excel file with Power queries to tables stored in that same file.
- Second one is mostly a different set of data about continuous improvement data, but i'd like to start linking them with the master file by having charts that compare efficiency to production, etc.
As it is now, I am using links by entering a direct reference to the cells/ranges in the master file (i.e: [Master.xlsm]!$A1:B2) However, every new version of the Master file, I have to update the links and it's not scalable if I have more documents in the future.
Options:
- Is it possible to store all the queries or data from the Master files in a separate file in the same folder and "call" for it when needed either in my Sales/Production master file or the Manufacturing file? That could be a database or connection file that has the queries to the data stored in the master file.
- If not, what is the best way to connect my Manufacturing file to my Master file without entering specifically the filename?
My fear is that as soon as the Master file name will change (date, version), I will have to navigate inside the queries and fix all the links again. Additionally, I wanna make this futureproof early one as I plan to gather large amounts of data and start more measurements.
Thanks for your help!
Once you have a data model built, you can create a connection to it from other Excel files. If you are looking for a visible way to control the source path of the connected file, you can add a named range to the Excel file that is connecting to the data model, and in the named range, enter the file path. In Power Query, add a new query that returns your named range (the file path), and swap out the static file path in your queries with the new named range query.
Here is a sample M code that gets the contents of a named range. This query is named "folderPath_filesToBeAudited".
let
Source = Excel.CurrentWorkbook(){[Name="folderPath_filesToBeAudited"]}[Content]{0}[Column1]
in
Source
Here is an example of M code showing how to use the new query to reference the file path.
Folder.Files(folderPath_filesToBeAudited)
Here is a step-by-step article.
https://accessanalytic.com.au/powerquery_namedcells_parameters/

Vba code in original file to track all copied files

Is it possible to insert a code so we can track all copied excel files in the future?
The reason why: we are creating a template excel file that people can copy and fill in. The problem is that they regularly have to fill in the same information so instead of starting from the template they copy the already filled in template.
If we decide to change the template, we want to change all the files that were copied so there are no multiple versions going around.
All the files are stored on a server in subfolders so We can access them all. Titles of the file will vary based on the wishes from the customer.
After reading you, I see that:
Summary:
You have one single Template that everybody copies
You store all the filled templates on one Server Subfolder
Title of the Files varies from Customer's needs
Challenges:
For Performance shake, you might need of a program than Excel to manage those files
Otherwise, it is possible to use Excel VBA, but is somehow/enough complicated so you would need to have an advanced skills and enough time to write everything handling that Subfolders' file renaming if you wish to collect the data in one Single Excel.
Suggested Solution:
I recommend you to have A Locked Worksheet + Workbook Excel
Template so your customers won't be able to edit its structure and
it will keep all of your templates to be the same.
You better have some kind of the Standard in the nomenclature of your Excel Files which will help you use that description later on for search/filter/sorting ...
You can have a Reset Button as well within the Template where your customers will click and will empty all the fields effortless.
In short, If you wish to track of files being copies, you would need more than Excel VBA for that as you need to play with A windows service for you to track them.
Hope this will give you some ideas. All the Best!

Pentaho Data Integration - Dump Excel into table

I'm very new to this tool and I want to do a simple operation:
Dump data from an XML to tables.
I have an Excel file that has around 10-12 sheets, and almost every sheet coresponds to a table.
With the first Excel input operation there is no problem.
The only problem is that, I don't know why but, when I try to edit (show the list of sheets, or get the list of columns) a second Excel Input the software just hangs, and when it responds just opens a warning with an error.
This is an image of the actual diagram that I'm trying to use:
This is a typical case of out of memory problem. PDI is not able to read the file and required more amount of memory to process the excel file. You need to give PDI more memory to work with your excel. Try increasing the memory of the Spoon. You can read Increase Spoon memory.
Alternatively, try to replicate your excel file with few rows of data keeping the structure of the file as it is e.g. a test file. You can either use that test file to generate the necessary sheet names and columns in excel step. Once you are done, you can point the original file and execute the job.

Automation of reading data from excel and pasting it in web form

I want to read from an excel file and copy the relevant data into a web form in the browser. I also need to check some conditions before pasting the data in the page according to the data in my excel sheet. How can I achieve that? What tool I can use to achieve the desired result?
Using Javascript may be fine, but I am looking for some kind of windows automation tools as in autohotkey to do the job.

CSV to Excel [xlsx] script

In excel I can open up a csv file using external data sources, and then chose to get data from text. This takes me through a set of steps to import the file. This works great, but I have a need to automate this process as many of these documents will need to be converted over time.
Is there a way to run a similar process as a script? I'm a complete newbie in this space.
You can run this command in a script:
csv2odf yourdata.csv yourtemplate.xlsx output.xlsx
You would need to get csv2odf and Python and create a template like this:
Insert column titles with the same number of columns as the csv.
Add one sample row of data. You can add formatting if you want.
Save the template as xlsx.

Resources