• Resolved Chuckie

    (@ajtruckle)


    Dear Plugin Developer,

    I’ve recently started managing the booking system on behalf of my client and am new to your plugin.

    My client also uses an external third-party application, and we’ve exported all upcoming appointments from that system into a CSV file. We noticed that your plugin supports importing ICS files, but not CSV files directly.

    Could you please advise on the available options for importing data from CSV? I’m open to developing a custom solution if necessary, but wanted to check if there are any recommended approaches, tools, or existing extensions that could help facilitate this.

    Best regards,
    Andrew

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author wpdevelop

    (@wpdevelop)

    Hello.
    Yes, the Booking Calendar can not import the bookings via CSV file, yet.

    If you want to make your custom soution for importing bookings from the CSV file, then probably you need to check this FAQ: https://wpbookingcalendar.com/faq/booking-calendar-api/

    You can use this function: wpbc_api_booking_add_new for creation of the new bookings in the Booking Calendar plugin.

    Example:

    	$booking    = array(
    'dates' => array( '2027-06-24', '2027-06-24', '2027-06-25', '2027-06-26' ),
    'data' => array(
    'secondname' => array( 'value' => 'Rika', 'type' => 'text' ),
    'name' => 'John',
    'email' => array( 'value' => '[email protected]', 'type' => 'email' ),
    )
    );
    $booking_id = wpbc_api_booking_add_new( $booking['dates'], $booking['data'] );

    Other Example for paid version, where you specified the ID of booking resource (calendar), where to save the booking:

    	$booking         = array(
    'dates' => array( '2027-08-24', '2027-08-25', '2027-08-26' ),
    'data' => array(
    'secondname' => array( 'value' => 'Smith', 'type' => 'text' ),
    'name' => 'John',
    'rangetime' => array( 'value' => '14:00 - 16:00', 'type' => 'selectbox-one' ),
    'email' => array( 'value' => '[email protected]', 'type' => 'email' ),
    ),
    'resource_id' => 3,

    );
    $booking_id = wpbc_api_booking_add_new( $booking['dates'], $booking['data'], $booking['resource_id'] );

    Please note, both examples will create a new bookings, only in case if the dates (and times, if provided) is available in destination booking resource (calendar). In case if you want to create a new booking without checking if the dates / times available and create booking in any case, then use the new parameter, like in this example:

    	$booking         = array(
    'dates' => array( '2027-08-24', '2027-08-25', '2027-08-26' ),
    'data' => array(
    'secondname' => array( 'value' => 'Smith', 'type' => 'text' ),
    'name' => 'John',
    'rangetime' => array( 'value' => '14:00 - 16:00', 'type' => 'selectbox-one' ),
    'email' => array( 'value' => '[email protected]', 'type' => 'email' ),
    ),
    'resource_id' => 3,

    );
    $booking_options = array( 'save_booking_even_if_unavailable' => 1 );
    $booking_id = wpbc_api_booking_add_new( $booking['dates'], $booking['data'], $booking['resource_id'], $booking_options );

    Hope it’s will helpful for you.

    Kind Regards.

    Thread Starter Chuckie

    (@ajtruckle)

    Thank you very much for your code examples. My client is using the paid version of the plugin. I will investigate the possibility of doing things the way you suggested.

    Is this a possible alternative?

    1. I write a csharp console app to convert the CSV data (using CsvHelper API) into ICS data (using DDay.iCal API.
    2. Then, use the built-in Import from ICS feature.

    Would that be possible? What I am not sure about this this approach:

    • Can we include more than one appointment in the same ICS file?
    • Which field data in the ICS file format does your plugin use?

    Thank you.

    Andy

    Plugin Author wpdevelop

    (@wpdevelop)

    Hello.

    1. Yes, you can include into one .ics feed more than one bookings.
    2. Find more information at this page: https://wpbookingcalendar.com/faq/what-fields-imported-exported/

    Kind Regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Importing appoints via CSV’ is closed to new replies.