Hi guys. Tell me how, when I click on the button, I can import data from an excel file, I did it, but for me it only writes the first line with values to the database, how can I write the entire contents of the file?

Hi Ruslan, 

please check this document and this post.

You'll find everything that you need.

Cheers

Hi Ruslan,

Can you share your excel file or can you verify the data in each cell which are trying to upload. data type of each column must be matching with entity column data type and also you can debug the code during the bootstrap.

check the service center logs for more ingratiation.

Regards,

Manish Jawla

If you need more detail, you can read this document - Import and export Excel, CSV and XML files.

Hi Ruslan,

You can use Bootstrap option in entity to generate the logic/ action automatically. Below is the image of how you can find this option when you right click on the entity.

Once you do the bootstrap it will create a timer and a server action. You can remove the timer if you want to import this data in your application at run time. But in server action you can find the logic to import excel data.

Keep in mind that you have to remove few condition from the server action because these generated action create this condition to avoide importing of data if entity is not empty.

Manish Jawla wrote:

Hi Ruslan,

Can you share your excel file or can you verify the data in each cell which are trying to upload. data type of each column must be matching with entity column data type and also you can debug the code during the bootstrap.

check the service center logs for more ingratiation.

Regards,

Manish Jawla



You can import data from Excel files to load data to your application server entities. This is useful when you are developing and testing your application. This way, you can quickly have your data up and running in the application while developing it.


Validate the Excel file

  1. Open the Excel file, check that the Excel sheet has the name of the Entity and the column headers have the names of the entity attributes.
  2. Close the file. The bootstrap cannot read the Excel file if it is open.

If your spreadsheet has blank cells and you're getting import errors, check this Development FAQ on how to proceed.


the data

To bootstrap data from an Excel file to an existing entity:

  1. In the Service Studio, go to the Data tab, right-click on the entity and in the Advanced menu, choose 'Create Action to Bootstrap data from an Excel...'.

  2. Select the Excel file, check the mappings to see if they are correct and click on Proceed.

    The Service Studio will automatically create:

    • An action with the bootstrap logic named "Bootstrap<entityname>" in the Server Actions folder in the Logic tab
    • A structure with the content of the Excel file named "Excel_<filename>" in the Structures folder in the Data tab
    • A resource with the Excel file in the Resources folder in the Data tab
    • A timer to execute the action at publish time named "Bootstrap<entityname>" in the Timers folder in the Processes tab
  3. Publish to bootstrap the data.

When you publish the module, it executes the action to bootstrap the data. If the entity already has data, the action with the bootstrap logic is not executed.


Nuno Miguel Verdasca wrote:

You can import data from Excel files to load data to your application server entities. This is useful when you are developing and testing your application. This way, you can quickly have your data up and running in the application while developing it.


Validate the Excel file

  1. Open the Excel file, check that the Excel sheet has the name of the Entity and the column headers have the names of the entity attributes.
  2. Close the file. The bootstrap cannot read the Excel file if it is open.

If your spreadsheet has blank cells and you're getting import errors, check this Development FAQ on how to proceed.


the data

To bootstrap data from an Excel file to an existing entity:

  1. In the Service Studio, go to the Data tab, right-click on the entity and in the Advanced menu, choose 'Create Action to Bootstrap data from an Excel...'.

  2. Select the Excel file, check the mappings to see if they are correct and click on Proceed.

    The Service Studio will automatically create:

    • An action with the bootstrap logic named "Bootstrap<entityname>" in the Server Actions folder in the Logic tab
    • A structure with the content of the Excel file named "Excel_<filename>" in the Structures folder in the Data tab
    • A resource with the Excel file in the Resources folder in the Data tab
    • A timer to execute the action at publish time named "Bootstrap<entityname>" in the Timers folder in the Processes tab
  3. Publish to bootstrap the data.

When you publish the module, it executes the action to bootstrap the data. If the entity already has data, the action with the bootstrap logic is not executed.


No, about importing data, I know, I just need to use the button in the web form to update or add data from the downloaded file to the database)))


Ruslan F. wrote:

Manish Jawla wrote:

Hi Ruslan,

Can you share your excel file or can you verify the data in each cell which are trying to upload. data type of each column must be matching with entity column data type and also you can debug the code during the bootstrap.

check the service center logs for more ingratiation.

Regards,

Manish Jawla




HI ruslan,

you need to add the loop after excel recordlist and call create action inside the loop because you need to iterate through the list of records.

Something like it :
Resultado de imagem para outsystems import data from excel